2011-01-10 13 views
2

안녕하세요, document.load에서 nav li의 높이를 줄이고 nav 아래 div를 애니메이션했습니다. 내가 뭘하고 싶은 것은 탐색의 각 리튬의 호버에 아래의 애니메이션 jQuery 코드 역입니다 :Jquery hover 토글

   $('.tabs li a').animate({ 
       height: '40' 
       }, 1000, function() { 
       // Animation complete. 
       }); 

       $('#tabs-wrap').animate({ 
       marginTop: '-=147' 
       }, 1000, function() { 
       // Animation complete. 
       }); 

어떻게 내가이 코드를 반전에 대한하지만, 호버 트리거와 함께 갈 것을 ??

감사합니다.

+0

애니메이션 높이는 "토글 (toggle)"로 수행 할 수도 있습니다. A가 완전히 보이지 않을 것입니까? – Marnix

답변

5

다음과 같은 것이 있습니까? 또한이 같은 애니메이션

$('tabs li a').hover(function(){ 
    $(this).animate({height:40}, 1000, function(){ 
     //animation complete 
    }); 
}, function(){ 
    $(this).animate({height:0}, 1000, function(){ 
     //animation complete 
    }); 
}); 

$('#tabs-wrap').hover(function(){ 
    $(this).animate({marginTop: '-147'}, 1000, function(){ 
    //animation complete 
    }); 

}, function(){ 
    $(this).animate({marginTop: '147'}, 1000, function(){ 
    //animation complete 
    }); 

}); 

주, 당신의 요소에 또 다른 애니메이션을 진행하기 전에 애니메이션을 중지해야합니다.

는 예 : 바로 그것을 가지고 있다면, 당신은 .hover() 기능을 찾고 있습니다

$(this).stop().animate({height:300}), 1000, function(){ }); 
+0

그것의 작동하지 않지만 재단 코드에 대한 감사합니다 – benhowdle89

+0

아무런 문제가 될 수있어서 다행입니다. –

0

당신을 해달라고?