class CssCommand implements CommandInterface (View source)

An AJAX command for calling the jQuery css() method.

The 'css' command will instruct the client to use the jQuery css() method to apply the CSS arguments to elements matched by the given selector.

This command is implemented by Drupal.AjaxCommands.prototype.css() defined in misc/ajax.js.

Properties

protected string $selector

A CSS selector string.

protected array $css

An array of property/value pairs to set in the CSS for the selector.

Methods

__construct(string $selector, array $css = [])

Constructs a CssCommand object.

$this
setProperty($property, $value)

Adds a property/value pair to the CSS to be added to this element.

render()

Implements Drupal\Core\Ajax\CommandInterface:render().

Details

__construct(string $selector, array $css = [])

Constructs a CssCommand object.

Parameters

string $selector

A CSS selector for elements to which the CSS will be applied.

array $css

An array of CSS property/value pairs to set.

$this setProperty($property, $value)

Adds a property/value pair to the CSS to be added to this element.

Parameters

$property

The CSS property to be changed.

$value

The new value of the CSS property.

Return Value

$this

render()

Implements Drupal\Core\Ajax\CommandInterface:render().