Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/81.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
Javascript 如何在悬停后设置移除背景的动画?_Javascript_Jquery_Jquery Ui - Fatal编程技术网

Javascript 如何在悬停后设置移除背景的动画?

Javascript 如何在悬停后设置移除背景的动画?,javascript,jquery,jquery-ui,Javascript,Jquery,Jquery Ui,我想在鼠标移到元素上设置背景后,用正确的方法移除背景 我试过这些: $("#store_header .right #nav ul li").hover(function() { $(this).animate({backgroundColor : '#0097d5'}, 200);} ,function() { $(this).animate({backgroundColor : ''}, 200); } ); 但是第二个功能不起作用,所以请告诉我什

我想在鼠标移到元素上设置背景后,用正确的方法移除背景

我试过这些:

$("#store_header .right #nav ul li").hover(function() {
    $(this).animate({backgroundColor : '#0097d5'}, 200);}
    ,function() {
        $(this).animate({backgroundColor : ''}, 200);
    }

);

但是第二个功能不起作用,所以请告诉我什么是错误,什么是正确的

您需要设置要还原的颜色,请选中。(注意:包括jquery ui)


您需要设置要还原的颜色,请选中。(注意:包括jquery ui)

$("#store_header .right #nav ul li").hover(function() {
    $(this).animate({backgroundColor : '#0097d5'}, 200);
    } ,function() {
        $(this).animate({backgroundColor : '#fff'}, 200);
    }
);
$("#store_header .right #nav ul li").hover(
    function() {
        $(this).animate({backgroundColor : '#0097d5'}, 200);
    }, function() {
        $(this).animate({backgroundColor : 'transparent'}, 200);
    }
);