jQuery change css attribute slowly

后端 未结 3 1712
忘掉有多难
忘掉有多难 2021-02-04 00:32

I have this code

$(\'#uiAdminPanelMenu li a\').hover( function(){
    $(this).css(\'background-color\', \'#D3E1FA\';
 },
 function(){
    $(this).css(\'backgroun         


        
3条回答
  •  没有蜡笔的小新
    2021-02-04 01:14

    You want to use animate(), but you also need the Color Plugin for jQuery.

    With the color plugin included, the following code works well:

    $('#uiAdminPanelMenu li a').hover( function(){
        $(this).animate({'background-color': '#D3E1FA'}, 'slow');
     },
     function(){
        $(this).animate({'background-color': '#F4F4F4'}, 'slow');
    });
    

提交回复
热议问题