0

機能に問題がありanimate()ます。最初に 2 つのオブジェクトをアニメーション化し、次に 4 秒間待ってから、そのオブジェクトを再びアニメーション化します。私のコードは次のようなものです:

//Animation In
$('.show').animate({marginTop : '1px' , opacity: '1px'},1000).delay(4000);
$('.caption').animate({opacity : '1px', top : '20px'},1000).delay(4000);       

//After 4 Second Animation Out       
$('.show').animate({ marginTop : '-200px', opacity:'0px'},1000);
$('.caption').animate({opacity : '0px' , top : '70px'},500,function()
   {         
                fadeInwhipe();// calls This Function
   });

.showこれはクラスに対して完全に機能しますが、 の.caption前に非常に速くアニメーション化することがあり.showます。次のように、早期のアニメーション化を防ぐため.captionに のコールバック関数に設定しようとしました。.show.caption

//Animation In
$('.show').animate({marginTop : '1px' , opacity: '1px'},1000).delay(4000);
$('.caption').animate({opacity : '1px', top : '20px'},1000).delay(4000);       

//After 4 Second Animation Out       
$('.show').animate({ marginTop : '-200px', opacity:'0px'},1000 ,function(){
    $('.caption').animate({opacity : '0px' , top : '70px'},500,function()
      {         
                fadeInwhipe();// calls This Function
      });
);

ただし、この場合、.show終了後にアニメーション化されます。実行中ですが、両方のクラスを一度にアニメーション化したいです。解決策はありますか?ありがとう ...

4

1 に答える 1

0

Queue:falseを使用する

$(function () {
    $("#first").animate({
       width: '200px'
    }, { duration: 200, queue: false });
    $("#first").animate({
       marginTop: '50px'
    }, { duration: 200, queue: false });
});
于 2012-01-13T19:19:17.477 に答える