2012-09-02 4 views
1

내가 올바른 방법이 요소 위에서 마우스,마우스를 올린 후 애니메이션을 제거하는 방법?

내가하려고 할 때 그것을 설정 한 후 배경을 제거하려면 다음 :

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

); 

하지만 두 번째 기능 때문에 오류가 무엇을 말씀 해주십시오 작동하지 않았고, 당신이 되돌릴 색상을 설정해야 올바른

답변

2

있어, the working demo을 확인합니다. (참고 : 포함 JQuery와 - UI)

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

Demo

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

한'작동하지만'none'이 작동하지 않습니다 transparent'. – undefined

관련 문제