Functiondojox.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.

Usage

function (/*DomNode|String*/ node, /*String*/ cssClass, /*Boolean?*/ condition) (view source)
parametertypedescription
nodeDomNode|StringThe domNode (or string of the id) to toggle
cssClassStringof the classname to add to the node
conditionBooleanOptional. 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();