开发者

Is it possible to include a CSS class name in jQuery .animate()

开发者 https://www.devze.com 2023-03-09 06:39 出处:网络
With jQuery .animate(), I use to write like .animate({ \'font-size\': \"24px\", \'color\': 开发者_如何学C\'#555\' }, 1000 ) to animate the item as per the CSS attributes.

With jQuery .animate(), I use to write like .animate({ 'font-size': "24px", 'color': 开发者_如何学C'#555' }, 1000 ) to animate the item as per the CSS attributes.

Is there a way in which I write a css class

.className{
    font-size : "24px";
    color : "#333";
}

and use that class to perform the .animate() function so that I don't have to write all the CSS attributes as the properties of the jquery .animate() function??


It's not "vanilla" jQuery, but jQuery UI has animation for addClass (plus toggle, switch, and remove).

0

精彩评论

暂无评论...
验证码 换一张
取 消