2012-08-09 59 views
1

我正在重新使用以下JavaScript來使對象淡出時單擊,但該對象不會淡出動畫。任何人都可以幫助我?對象不淡出

<script type="text/javascript"> 
    $(document).ready(function() { 

     $curtainopen = false; 

     $(".sticker").click(function(){ 
      $(this).blur(); 
      if ($curtainopen == false){ 
       $(this).stop().fadeOut(1600, "linear", complete); 
       $(".leftcurtain").stop().animate({top:'-2000px'}, 6000); 
       $(".rightcurtain").stop().animate({bottom:'-2000px'},6000); 
       $curtainopen = true; 
      }else{ 
       $(this).stop().animate({top: '-40px' }, {queue:false, duration:350, easing:'easeOutBounce'}); 
       $(".leftcurtain").stop().animate({width:'50%'}, 2000); 
       $(".rightcurtain").stop().animate({width:'51%'}, 2000); 
       $curtainopen = false; 
      } 
      return false; 
     }); 

    }); 
</script> 

這裏的原始的javascript:

<script type="text/javascript"> 
    $(document).ready(function() { 

     $curtainopen = false; 

     $(".sticker").click(function(){ 
      $(this).blur(); 
      if ($curtainopen == false){ 
       $(this).stop().animate({top: '-300px' }, {queue:false, duration:1000, easing:'easeOutBounce'}); 
       $(".leftcurtain").stop().animate({top:'-2000px'}, 6000); 
       $(".rightcurtain").stop().animate({bottom:'-2000px'},6000); 
       $curtainopen = true; 
      }else{ 
       $(this).stop().animate({top: '-40px' }, {queue:false, duration:350, easing:'easeOutBounce'}); 
       $(".leftcurtain").stop().animate({width:'50%'}, 2000); 
       $(".rightcurtain").stop().animate({width:'51%'}, 2000); 
       $curtainopen = false; 
      } 
      return false; 
     }); 

    }); 
</script> 
+0

它會幫助,如果你發佈你的標記,讓我們更容易在jsFiddle中玩它。 – 2012-08-09 17:17:17

回答

0

所有你需要做的是:

$(this).fadeOut(); 

,而不是

$(this).stop().fadeOut(1600, "linear", complete);