Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在此JQuery字符串中添加按钮的活动状态_Jquery - Fatal编程技术网

如何在此JQuery字符串中添加按钮的活动状态

如何在此JQuery字符串中添加按钮的活动状态,jquery,Jquery,我刚刚学习了关于的教程,需要了解如何在这个JQuery字符串上添加活动状态 enter code here <script type="text/javascript"> <!-- $(function () { //$('div.fade li.active') //.css( {backgroundColour: "#000000"} ) //.mouseover(function(){ // $(this).s

我刚刚学习了关于的教程,需要了解如何在这个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>
在此处输入代码
使用单击方法

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