首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >jQuery animate().delay().animate()我这样做对吗?

jQuery animate().delay().animate()我这样做对吗?
EN

Stack Overflow用户
提问于 2011-11-14 11:42:35
回答 2查看 218关注 0票数 1

在firefox (相当糟糕)和chrome (ok)之间获得不同的性能和效果。有时这不能完成第一个动画,有时会卡住。

我的结构正确吗?

代码语言:javascript
复制
$notification.animate({
    top: '-=' + ($notification.outerHeight() + 20)
    }, 1500, function() {
        $(this).delay(2000);
        $(this).animate({
            top: '+=' + ($notification.outerHeight() + 20)
        }, 1500, function() {

    });
});
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-11-14 11:52:18

试试这个:

代码语言:javascript
复制
$notification
    .animate({
        top: '-=' + ($notification.outerHeight() + 20)
    }, 1500)
    .delay(2000)
    .animate({
        top: '+=' + ($notification.outerHeight() + 20)
    }, 1500);

编辑:http://zequinha-bsb.int-domains.com/notification.html的小提琴

票数 2
EN

Stack Overflow用户

发布于 2011-11-14 11:48:59

尝尝这个

代码语言:javascript
复制
$notification.animate({
    top: '-=' + ($notification.outerHeight() + 20)
    }, 1500, function() {
        $(this).delay(2000).animate({
            top: '+=' + ($notification.outerHeight() + 20)
        }, 1500, function() {

    });
});
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8117065

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档