如何知道Jquery的动画进度? [英] How to know Jquery animate progress?

查看:62
本文介绍了如何知道Jquery的动画进度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网页,通过从顶部滑动带来另一个页面...我已经使用jquery animate实现了这个...现在我的查询是如何知道animate()方法的进度百分比...喜欢从页面开始滑动到完成

I have a web page which brings another page by sliding from the top... I have achieved this using jquery animate... Now my query is how can i know the percentage of progress of animate() method... Like from the page starts sliding to its completion

谢谢

推荐答案

您可以使用 步骤 -callback ,您在动画选项中传递以在每一步执行一个函数。你可以调查一下。

You can use the step-callback, which you pass in the animation options to execute a function on every step. You could look into that.

$('#myElement').animate({/*Your animation options.*/}, {
  step: function(current_number){
    /* measure stuff using the first argument passed to this function */
  }
})

编辑
@ Rocket 演示

这篇关于如何知道Jquery的动画进度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆