jQuery向上滑动故障

时间:2015-01-07 20:10:08

标签: 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');

});

1 个答案:

答案 0 :(得分:1)

您需要为元素的高度设置动画。使用向上滑动或向下滑动将缩小并隐藏或显示您已有的元素:

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