最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - JQuery animation: Is it possible to change speed during the animation? - Stack Overflow

programmeradmin8浏览0评论

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();
    });
}

Is it possible to slow down an JQuery animation?

If not what are the alternatives?

Thanks.

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();
    });
}

Is it possible to slow down an JQuery animation?

If not what are the alternatives?

Thanks.

Share Improve this question edited Dec 18, 2014 at 8:56 Anik Islam Abhi 25.4k8 gold badges59 silver badges81 bronze badges asked Mar 4, 2010 at 19:09 SirMorenoSirMoreno 1,1071 gold badge15 silver badges34 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 7

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

http://api.jquery./animate/

You might want to check this out: http://www.learningjquery./2009/02/quick-tip-add-easing-to-your-animations

Easing can really bring life to an effect. Easing controls how an animation progresses over time by manipulating its acceleration.

发布评论

评论列表(0)

  1. 暂无评论