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

时间:2011-11-14 03:42:35

标签: jquery

你得到变量的性能& firefox(非常糟糕)chrome(ok)之间的效果 有时这不会做第一个动画,有时它会卡住。

我的结构是否正确?

$notification.animate({
    top: '-=' + ($notification.outerHeight() + 20)
    }, 1500, function() {
        $(this).delay(2000);
        $(this).animate({
            top: '+=' + ($notification.outerHeight() + 20)
        }, 1500, function() {

    });
});

2 个答案:

答案 0 :(得分:3)

试试这个

$notification.animate({
    top: '-=' + ($notification.outerHeight() + 20)
    }, 1500, function() {
        $(this).delay(2000).animate({
            top: '+=' + ($notification.outerHeight() + 20)
        }, 1500, function() {

    });
});

答案 1 :(得分:2)

试试这个:

$notification
    .animate({
        top: '-=' + ($notification.outerHeight() + 20)
    }, 1500)
    .delay(2000)
    .animate({
        top: '+=' + ($notification.outerHeight() + 20)
    }, 1500);

编辑:在http://zequinha-bsb.int-domains.com/notification.html

处小提琴