dojox.fx.toggleClass
dojo.require("dojox.fx.style");
defined in dojox/fx/style.js
creates an animation that will animate the effect of toggling a class on or off of a node. Adds a class to node if not present, or removes if present. Pass a boolean condition if you want to explicitly add or remove.
parameter | type | description |
---|---|---|
node | DomNode|String | The domNode (or string of the id) to toggle |
cssClass | String | of the classname to add to the node |
condition | Boolean | Optional. If passed, true means to add the class, false means to remove. |
Examples
Example 1
// add the class "sampleClass" to a node id="theNode"
dojox.fx.toggleClass("theNode","sampleClass",true).play();
Example 2
// toggle the class "sampleClass" on the node id="theNode"
dojox.fx.toggleClass("theNode","sampleClass").play();