jQuery动画:可以在动画过程中更改速度吗? [英] JQuery animation: Is it possible to change speed during the animation?

查看:130
本文介绍了jQuery动画:可以在动画过程中更改速度吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将div向下移动一页,并且当它到达目标位置时我希望它放慢速度.

I want to move a div down a page, and I want it to slow down as it reaches the target.

我尝试将回调函数与递归函数一起使用,但看起来并不流畅:

I tried using call back with recursive func but it doesn’t look smooth:

function MovePanel() {
    sidePanel.animate({
        "marginTop": newCurrTop
    }, moveSpeed, function () {
        MovePanel();
    });
}

是否可以减慢JQuery动画的速度?

Is it possible to slow down an JQuery animation?

如果没有,还有什么选择?

If not what are the alternatives?

谢谢.

推荐答案

animate方法采用称为缓动"的第三个参数;在这里了解它:

The animate method takes a 3rd param called "easing"; learn about it here:

http://api.jquery.com/animate/

这篇关于jQuery动画:可以在动画过程中更改速度吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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