jquery“animate”变量值 [英] jquery "animate" variable value
本文介绍了jquery“animate”变量值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使用jquery动画化变量。
I need to "animate" a variable with jquery.
示例:
变量值为1. 5秒后该值应为10。
它应该平稳地增加。
Example: The variable value is 1. The value should be 10 after 5 seconds. It should be increase "smoothly".
希望你知道我的意思。
谢谢!
推荐答案
What you require is the step parameter in the $().animate
function.
var a = 1;
jQuery('#dummy').animate({ /* animate dummy value */},{
duration: 5000,
step: function(now,fx){
a = 1 + ((now/100)*9);
}
});
这篇关于jquery“animate”变量值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文