Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

48 lines (47 sloc) 1.833 kb
<?xml version="1.0"?>
<entry name="switchClass" type="method" return="jQuery">
<title>.switchClass()</title>
<desc>Adds and removes the specified class(es) to each of the set of matched elements while animating all style changes.</desc>
<longdesc>
<p>The <code>.switchClass()</code> method allows you to animate the transition of adding and removing classes at the same time.</p>
<xi:include href="../includes/class-animation-desc.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
<xi:include href="../includes/core-extension-desc.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
</longdesc>
<signature>
<argument name="removeClassName" type="String">
<desc>One or more class names (space separated) to be removed from the class attribute of each matched element.</desc>
</argument>
<argument name="addClassName" type="String">
<desc>One or more class names (space separated) to be added to the class attribute of each matched element.</desc>
</argument>
<xi:include href="../includes/animation-argument-duration.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
<xi:include href="../includes/animation-argument-easing.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
<xi:include href="../includes/animation-argument-complete.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
</signature>
<example>
<desc>Adds the class "blue" and removes the class "big" from the matched elements.</desc>
<css><![CDATA[
div {
width: 100px;
height: 100px;
background-color: #ccc;
}
.big {
width: 200px;
height: 200px;
}
.blue {
background-color: #00f;
}
]]></css>
<html><![CDATA[
<div class="big"></div>
]]></html>
<code><![CDATA[
$( "div" ).click(function() {
$( this ).switchClass( "big", "blue", 1000, "easeInOutQuad" );
});
]]></code>
</example>
<category slug="effects"/>
</entry>
Jump to Line
Something went wrong with that request. Please try again.