问题描述
使用Jani动画,我想使用在.css文件中某个位置定义的css类进行操作,而不必将所有样式参数都明确地赋予jquery.animate().
Using JQuery animate I would like to operate with css classes, defined somewhere in .css file, not to have to give all styles params to jquery.animate() explicitly.
我可以使用此类创建一个假的(例如,不可见的)元素,读取其CSS属性并将其提供给jquery.animate()-有人知道更好的方法吗?
I can create a fake (e.g. invisible) element with such a class, read its css properties and give them to jquery.animate() - does anybody know a better way?
推荐答案
jQueryUI 提供了对animate
的扩展可以让CSS类动画的功能.
The jQueryUI provides a extension to animate
function that allows you to animate css class.
编辑:示例此处
您也可能对添加/删除/切换类的方法感兴趣.
There are also methods to add/remove/toggle class which you might also be interested in.
这篇关于jQuery.animate()仅具有CSS类,没有显式样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!