我目前有一个 jQuery 脚本,它使用 jquery-circle-progress
(第三方插件)来计数到某个数字。例如,假设变量 rand
保存该数字。然后,该脚本会查找指定的元素,然后从零开始计数到该数字。
我想检测动画何时结束。我考虑过等到 element.val == rand
,然后执行另一个函数。
$('#circle').circleProgress({
value: (rand/100) }).on('circle-animation-progress', function(event, progress) {
$(this).find('.element').html(parseInt( 100 * progress * rand/100));
});
然后我想做一些类似的事情
on element.val == rand
执行一些函数()
因此它等待 element.val 等于 rand
然后执行一个函数。
或者有没有更简单的方法来检测动画完成情况?
我知道这是具体的,TIA。
最佳答案
快速浏览 https://github.com/kottenator/jquery-circle-progress显示 circle-animation-end
事件。我不熟悉这个插件,但我希望您可以在使用以下内容调用 $('#circle').circleProgress()
后 Hook 此事件:
$('#circle').on('circle-animation-end', function(){
alert('animation complete');
});
关于javascript - jQuery 元素值等于 x,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31356706/