主题
自定义动画
除了基本的淡入淡出和滑动效果,jQuery 还提供 animate()
方法,用于自定义元素属性变化的动画过程。
animate 方法语法
js
$(selector).animate(properties, duration, easing, callback);
properties
:要改变的 CSS 属性对象duration
:动画持续时间(如"slow"
、"fast"
或毫秒数)easing
:缓动函数(如"swing"
或"linear"
)callback
:动画完成后执行的函数
支持动画的属性示例
width
、height
opacity
margin
、padding
left
、top
(需设置定位)
示例代码
loading