[英]velocity.js progress callback function not working
I have used velocity.js to animate something on page but in progress callback function does not working for me. 我使用了Velocity.js为页面上的内容制作动画,但是进行中的回调函数对我不起作用。 I am getting null value for the tweenValue para.
我正在为tweenValue参数获取空值。
Here is the code. 这是代码。
$element.velocity({ opacity: 0, tween: 1000 // Optional }, { progress: function(elements, complete, remaining, start, tweenValue) { console.log((complete * 100) + "%"); console.log(remaining + "ms remaining!"); console.log("The current tween value is " + tweenValue) } });
Your example works fine when I try it on the document body, 当我在文档正文上尝试时,您的示例效果很好,
$("body").velocity({
opacity: 0,
tween: 1000 // Optional
}, {
progress: function p(elements, complete, remaining, start, tweenValue) {
console.log((complete * 100) + "%");
console.log(remaining + "ms remaining!");
console.log("The current tween value is " + tweenValue)
}
});
It logs messages like the following 它记录如下消息
4%
VM740:8 384ms remaining!
VM740:9 The current tween value is 3.942649342761062
I used the latest 1.2.2 version from github, https://github.com/julianshapiro/velocity/blob/master/velocity.js and I used requirejs to load velocity and jquery in the page 我使用了来自github的最新1.2.2版本, https://github.com/julianshapiro/velocity/blob/master/velocity.js ,我使用requirejs在页面中加载了速度和jquery
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.