2013-02-20 106 views
0

我在靠近好几箱,其表现出不同的框,当所有的条子都上空盘旋,这里是一个代码段(不完整的,所以没有小提琴):的mouseenter /鼠标离开结合适当避免闪烁框

<div id="big_square_1" class="big_square" style="display:none;"></div> 
<div id="big_square_2" class="big_square" style="display:none;"></div> 
<div id="big_square_3" class="big_square" style="display:none;"></div> 
<div id="big_square_4" class="big_square" style="display:none;"></div> 

和jQuery的:

$("#big_square_1").mouseenter(function() { 
     $('#big_square_1').css("border", "1px solid #191919").css("height", "98px").css("width","98px"); 
     $('#hover_Box').fadeIn('fast'); 
    }); 
    $("#big_square_1").mouseleave(function() { 
     $('#big_square_1').css("border", "inherit").css("height", "100px").css("width", "100px"); 
     $('#hover_Box').fadeOut('fast'); 
    }); 
    $("#big_square_2").mouseenter(function() { 
     $('#big_square_2').css("border", "1px solid #191919").css("height", "98px").css("width","98px"); 
     $('#hover_Box').fadeIn('fast'); 
     $('#side_box_1').append('<br><br><br><p>This is ARC</p>'); 
    }); 
    $("#big_square_2").mouseleave(function() { 
     $('#big_square_2').css("border", "inherit").css("height", "100px").css("width", "100px"); 
     $('#hover_Box').fadeOut('fast'); 
    }); 

我已分别配置了这些事件,让我可以用html的内容添加到箱子以后。然而,现在,当这些盒子快速翻转时,“快速”速度不够快,而它们渐渐消失的盒子最终闪烁。我如何修改我的鼠标/鼠标叶片以防止此眨眼? (我是.stop/.bind新手)。另外,我知道我可以使用简写多个CSS更改,我只是喜欢这样做,直到我解决了悬停问题。

+1

您是否真的在代码中使用'.stop()'?这似乎解决了你的问题。 – j08691 2013-02-20 16:55:54

+0

不,我没有,因为我不知道该把它放在哪里: $('#hover_Box')。fadeOut('fast')。stop()或者整个函数? – Deprecated 2013-02-20 17:02:38

+1

尝试在fadeIn和fadeOut之前放置'.stop(true,true)'。 – j08691 2013-02-20 17:05:37

回答

2

尝试在淡入和淡出之前放置.stop(true,true)