jQuery change css attribute slowly

后端 未结 3 1650
忘掉有多难
忘掉有多难 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:19

    You can accomplish the same thing with CSS3 transitions. The result will almost be the exact same.

    #uiAdminPanelMenu li a {
        background-color: F4F4F4;
        -webkit-transition: background-color 0.4s ease;
        -moz-transition: background-color 0.4s ease;
        -o-transition: background-color 0.4s ease;
        transition: background-color 0.4s ease;
    }
    
    #uiAdminPanelMenu li a:hover {
        background-color: D3E1FA;
    }
    

提交回复
热议问题