jquery qTip 鼠标悬停浏览器崩溃
我试图在鼠标悬停事件中显示工具提示。我动态创建工具提示而不是作为前体(即在 document.ready 中创建 qtip)的原因是我生成了映射到对象列表的项目列表,并且存储了每个对象的哈希键在“li”中隐藏元素的对象列表中,因此每次鼠标悬停在 li 元素上时我都会抓住它。
但重要的是,我似乎无法在鼠标悬停时显示工具提示,并且我注意到添加 qtip 会生成大量导致浏览器崩溃的鼠标悬停事件:
$('.result-company-name').mouseover(function() {
var key = $(this).parent().parent().parent().find('.result-company-key').text();
var group = thisview.objGroup.getGroupFromKey(key);
var contacts = group.spotlight().fields.contacts;
if(!contacts)
return;
var qt = $(this).qtip(
{
content: contacts.length,
});
qt.qtip("show");
}
有什么想法吗?谢谢。
I am trying to show a tooltip in a mouseover event. The reason I am creating the tooltip on the fly rather than as a precursor (i.e. creating the qtip in document.ready) is that I have generated a list of items that map to a list of objects and I store the hash key for each object in the object list in a hidden element in the "li", so I grab that every time there is a mouseover on an li element.
What is important though is that I can't seem to get the tooltip to display in the mouseover, and I notice that adding the qtip is generating a lot of mouseover events that crash the browser:
$('.result-company-name').mouseover(function() {
var key = $(this).parent().parent().parent().find('.result-company-key').text();
var group = thisview.objGroup.getGroupFromKey(key);
var contacts = group.spotlight().fields.contacts;
if(!contacts)
return;
var qt = $(this).qtip(
{
content: contacts.length,
});
qt.qtip("show");
}
Any thoughts? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许您正在某处生成无限循环?
Maybe you are generating an infinite loop somewhere?
通过使用 show: { ready: true } 修复以在创建工具提示时立即显示它。似乎工作正常。
Fixed by using show: { ready: true } to show the tooltip right away when I created it. Seems to be working fine.