无法以正确的顺序为元素设置动画?

时间:2014-01-21 08:54:20

标签: jquery

我遇到一个问题,即fadeout在开始淡出之前等待动画结束,即使它应该首先淡出。

有什么方法可以让它同时发生?

$('.hover-div').mouseout(function() {

        $('div.hidden').fadeOut(); // this happens AFTER the following animations are done

        $('.carousel-bg').animate({
            'top': 112,
            'height': 130
        }, 200);

        $('div.carousel-holder div.text').animate({
            'top': 125
        });
    }); 

2 个答案:

答案 0 :(得分:0)

milliseconds中管理您的显示速度试试这个: -

    $('div.hidden').fadeOut(50);

    $('.carousel-bg').animate({
        'top': 112,
        'height': 130
    }, 200);

    $('div.carousel-holder div.text').animate({
        'top': 125
    }, 200);

答案 1 :(得分:0)

$('.hover-div').mouseout(function() {


        $('.carousel-bg').animate({
            'top': '112px',
            'height': '130px'
        }, 200);

        $('div.carousel-holder div.text').animate({
            'top': '125px'
        }, function() {  $('div.hidden').fadeOut(); });
    });