2015-01-07 105 views
-1

當我將鼠標懸停在元素上時,它會快速滑動然後回落,但在您知道之前會消失。jQuery上滑故障

jQuery('.touchcarousel-item').on('mouseover', function(){ 

    jQuery('.tc-desc').css('height', '+=292').stop(true).slideUp(); 

}); 

jQuery('.touchcarousel-item').on('mouseout', function(){ 

    jQuery('.tc-desc').css('height', '58px'); 

}); 
+0

顯示您的HTML。使用創建小提琴的堆棧片段。 –

+0

@Sleek Geek比這更好,這是一個鏈接到網站:http://codecreatif.com/c6/ - 將滑塊懸停在縮略圖標題所在的位置。 –

+0

@ user2984926它看起來像爲鼠標懸停在圖像上的每個實例添加了292個像素。我建議使用'hover'或'mouseenter' – ntgCleaner

回答

1

您需要動畫元素的高度。使用上移或下滑將縮小並隱藏或顯示您已有的元素:

$('.touchcarousel-item').hover(function(){ 
    $('.tc-desc').animate({'height':'100%'}); 
}, function(){ 
    $('.tc-desc').animate({'height':'65px'}); 
}