2013-12-15 78 views
1

我有一些褪色某些元素的小问题。 这是我的例子:jquery mouseover/mouseout probel

http://jsfiddle.net/7uXtw/

当你将鼠标悬停在黑方则显示为灰色广场和文字“一些文本” 当鼠标离开一切都应该进入启动状态。

主要问题关注广场上的快速鼠标悬停和mouseleave。然后文本“一些文本”不fadeOut。我如何改变我的代码来修复这个bug?

我以前.stop()但它不解决问题

+0

检查这个问题:HTTP://计算器.com/questions/2805906/jquery-stop-fadein-fadeout –

回答

0

隐藏DAT溢出

我只是在CSS中添加overflow:hiddena,它似乎工作的伟大。

.info_text大于其父母a,因此mouseleave在清除之前不会触发。

jQuery的 这个配置停止和停止(真,真)似乎这样的伎俩

$("#options_down li").delegate('a','mouseover mouseleave', function(e){ 
    if (e.type == 'mouseover') {//on mouseover 
     $(this).find('img').stop().animate({ top: '+36px'},100).end()//img down 
     .find(".info").stop().animate({ height: '136', opacity: 0.8 }, 100).end()//info out 
     .find('.info_text').stop(true,true).delay(100).fadeIn(100).end()//infotext in 
     .find('.info p, .info h3').stop().fadeOut(100);//hide innards 
    } else if (e.type == 'mouseleave') {//on mouseleave 
     $(this).find("img").stop(true,true).animate({ top: '0px' },100).end()//img up 
     .find(".info").stop(true,true).animate({ height: '40', opacity: 1 }, 100).end()//info in 
     .find('.info_text').stop().fadeOut(100).end()//infotext out 
     .find('.info p, .info h3').stop(true,true).fadeIn(100);//show innards 
    } 
}); 

做出了小提琴:http://jsfiddle.net/filever10/rb48W/

+0

现在看起来不错,谢谢! – Papub

+0

没问题,很高兴帮助! – FiLeVeR10