jquery的animate怎么获取动画的CSS属性呢?
发布网友
发布时间:2022-04-21 04:17
我来回答
共1个回答
热心网友
时间:2022-06-17 22:48
看了一下jquery'的API,看到animate方法的介绍里有:
.animate( properties, options )
options -> progress
Type: Function( Promise animation, Number progress, Number remainingMs )
每一步动画完成后调用的一个函数,无论动画属性有多少,每个动画元素都执行单独的函数。(version added: 1.8)
应该这样写:
$('.div').animate(
{
top:'200px'
},
{
easing:'linear',
ration: 3500, //延时换这种方式写
progress: function() {
$(".div").text($('.div').css("top"))
}
},
function() {
$(".div").text($('.div').css("top"))
}
);追问没有用啊