JQuery slideUp和slideDown在Chrome中无法正常工作

JQuery slideUp和slideDown在Chrome中无法正常工作,jquery,Jquery,它超越了标记,然后在Chrome中再次出现,但在Firefox中没有出现 在这里滚动图片 这是我正在使用的代码 // Set height on excerpt for smooth animation jQuery(".excerpt").each (function() { jQuery(this).css("height", jQuery(this).height()); }); // Hide excerpts by default jQuery('.excerpt').hid

它超越了标记,然后在Chrome中再次出现,但在Firefox中没有出现

在这里滚动图片

这是我正在使用的代码

// Set height on excerpt for smooth animation
jQuery(".excerpt").each (function() {
    jQuery(this).css("height", jQuery(this).height());
});

// Hide excerpts by default
jQuery('.excerpt').hide();

// Fade in 
jQuery(".slide").hoverIntent({
    over: slidein,
    timeout: 100,
    out: slideout
}); 

function slidein(){ 
    // jQuery(this).addClass('active').find('.excerpt').animate({"height":500},400);
    jQuery('.slide').not(this).animate({opacity:0.3},400);
    jQuery(this).addClass('active').find('.excerpt').slideDown(500);    
} 
function slideout(){ 
    // jQuery(this).find('.excerpt').animate({"height":0},400);
    jQuery('.slide').removeClass('active').animate({opacity:1},400);
    jQuery(this).find('.excerpt').slideUp(1500);    
} 
.height()方法是导致问题的原因吗?也许可以尝试使用css(而不是javascript)设置固定高度

我看到的问题是,如果在每个动画出现之前将鼠标移到几个项目上,它会有奇怪的行为。如果移动速度足够快,我会看到文字被图像替换

也许考虑这样做:

jQuery('.slide').not(this).stop().animate({opacity:0.3},400);
jQuery(this).addClass('active').find('.extract').stop().slideDown(500)

这是:

jQuery('.slide').stop().removeClass('active').animate({opacity:1},400);
jQuery(this).addClass('active').find('.extract').stop().slideDown(500)

stop()取消当前动画

您还可以使用.animate、.slideUp和.slideDown提供的回调函数。从文档中:

.animate( properties, [ duration ], [ easing ], [ callback ] )


然后绑定和解除绑定到一些自定义事件,为您制作动画,但这可能有些过分。

遗憾的是,前两个解决方案不起作用。如果我能弄明白,我就试试最后一个。谢谢。如果应用此项的元素具有最小高度,则会出现另一个pb!
.animate( properties, [ duration ], [ easing ], [ callback ] )
.slideUp( [ duration ], [ callback ] )