jQuery animate().delay().animate() am I doing this right?



我得到可变性能&firefox(很差)和chrome(还行)之间的效果有时它不做第一个动画,有时它卡住了。

我的结构对吗?

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

试试这个

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

试试这个:

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

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

最新更新