在IE8中,QTip效率,将QTip放在1000个元素上非常慢

时间:2012-01-12 16:56:20

标签: jquery qtip2

我有一个包含数百个元素的页面,需要在鼠标悬停时使用QTip。这是杀死IE8,虽然其他浏览器似乎表现良好。

为了解决这个问题,我试图在用户将鼠标放在元素的容器上时创建QTips,这样它一次只能做到100-200,而不是一次只有1000+。

$('#color-family /*ID of body*/> .strctr-contain /*containing class*/').live('mouseover', function(){
   $(this).children('.palette .color-swatch, .stain-swatch, .color-swatch-dash').qtip({//foo}
})
 });

当您将鼠标悬停在容器上时,此功能会触发,但是,当您将鼠标悬停在子项上时,它会反复触发此功能,而不是显示工具提示。

3 个答案:

答案 0 :(得分:2)

也许最好使用“一个”功能,它会为你完成所有工作。

$('#color-family /ID of body/> .strctr-contain /containing class/').one('mouseover', function(){

     $(this).children('.palette .color-swatch, .stain-swatch, .color-swatch-dash').qti({//foo} ); 

});

答案 1 :(得分:0)

这将在鼠标悬停绑定运行一次后删除...

$('#color-family /*ID of body*/> .strctr-contain /*containing class*/').on("mouseover", function(){
   $(this).children('.palette .color-swatch, .stain-swatch, .color-swatch-dash').qtip({ //foo }).off("mouseover");
});

它只需要添加unbind(off)。

答案 2 :(得分:0)

好吧,如果我们只使用绑定功能,我会在第一次创建qtips后尝试取消绑定动作:

$('#color-family / 正文ID /> .strctr-contains / 包含类 /')。bind('mouseover',function( ){

$(this).children('。palette .color-swatch,.stain-swatch,.color-swatch-dash')。qtip({// foo});    $(本).unbind( '鼠标悬停');

});

相关问题