📅  最后修改于: 2020-10-23 07:27:13             🧑  作者: Mango
本章将讨论removeClass()方法,该方法是用于管理jQueryUI视觉效果的方法之一。 removeClass()方法从元素中删除应用的类。
removeClass()方法在对所有样式更改进行动画处理时,将指定的类删除到匹配的元素。
removeClass()方法的基本语法如下:
.removeClass( className [, duration ] [, easing ] [, complete ] )
Sr.No. | Parameter & Description |
---|---|
1 |
className This is a String containing one or more CSS classes (separated by spaces) to be removed. |
2 |
duration This is of type Number or String, and indicates the number of milliseconds of the effect. A value of 0 takes the element directly in the new style, without progress. Its default value is 400. |
3 |
easing This is of type String and indicates the way to progress in the effect. Its default value is swing. Possible values are here. |
4 |
complete This is a callback method called for each element when the effect is complete for this element. |
在1.9版中,此方法现在支持子选项,该选项还将为后代元素设置动画。
.removeClass( className [, options ] )
Sr.No. | Parameter & Description |
---|---|
1 |
className This is a String containing one or more CSS classes (separated by spaces). |
2 |
options This represents all animation settings. All properties are optional. Possible values are −
|
以下示例演示了removeClass()方法的用法。
jQuery UI removeClass Example
Hello!
让我们将上面的代码保存在HTML文件removeclassexample.htm中,并在支持javascript的标准浏览器中将其打开,您还必须看到以下输出。现在,您可以处理结果了-
单击添加类和删除类按钮以查看框中的类效果。