开发者

How to add active state on button in this JQuery String

i just followed a tutorial on http://jqueryfordesigners.com/image-cross-fade-transition/ and need to figure out how to add a active state on this JQuery string.

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).开发者_JAVA技巧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>


Use the click method

$('.yourdiv').click(function(){
 // code
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜