2011-07-26 2 views
0

私はちょうどhttp://jqueryfordesigners.com/image-cross-fade-transition/のチュートリアルをたどり、このJQuery文字列にアクティブ状態を追加する方法を理解する必要があります。このJQuery文字列でボタンのアクティブ状態を追加する方法

enter code here 

<script type="text/javascript"> 
<!-- 

$(function() { 
    //$('div.fade li.active') 
     //.css({backgroundColour: "#000000"}) 
     //.mouseover(function(){ 
     // $(this).stop().animate({backgroundPosition:"(-20px 94px)"}, {duration:500}) 
     //}) 
     //.mouseout(function(){ 
     // $(this).stop().animate({backgroundPosition:"(40px 35px)"}, {duration:200, complete:function(){ 
     //  $(this).css({backgroundPosition: "-20px 35px"}) 
     // }}) 
     //}) 
    // find the div.fade elements and hook the hover event 
    $('div.fade').hover(function() { 
     // on hovering over find the element we want to fade *up* 
     var fade = $('> div', this); 

     // if the element is currently being animated (to fadeOut)... 
     if (fade.is(':animated')) { 
      // ...stop the current animation, and fade it to 1 from current position 
      fade.stop().fadeTo(250, 1); 
     } else { 
      fade.fadeIn(250); 
     } 
    }, function() { 
     var fade = $('> div', this); 
     if (fade.is(':animated')) { 
      fade.stop().fadeTo(250, 0); 
     } else { 
      fade.fadeOut(250); 
     } 
    }); 
}); 

//--> 
</script> 

答えて

0

クリック方法

$('.yourdiv').click(function(){ 
// code 
}); 
を使用します
関連する問題