我的工作代码:
$("#selectResult").append("<div id='"+arr[this.id]+"' class='inline'
title='Co. "+arr[this.id]+"'></div>");
$("#"+arr[this.id]).css({'background-image' : 'url(./img/coatofarms/'
+arr[this.id]+'.png)','background-repeat': 'no-repeat','background-position':
'bottom'}).qtip(countyCrest);
在我附加 div 的第一个选择中,我给出了标题,当我检查元素时,title
是它应该的样子。
然后,当我更改 div 的第二个选择中的 .css 时,检查元素标题现在是 oldtitle="Co.Down"title=""
这是怎么回事?
这是检查元素代码
<div id="Antrim" class="inline" style="background-image:
url(http://danu2.it.nuigalway.ie/09101916/trazoo/demo_1/img/coatofarms/Antrim.png);
background-position: 50% 100%; background-repeat: no-repeat no-repeat; "
oldtitle="Co. Antrim" title=""></div>
最佳答案
qTip 清空 title 属性,这样您就不会同时看到 qTip 气球和默认浏览器工具提示。原始标题存储在 oldtitle
属性中。
更具体地说:
Unfortunately the title attribute has to be removed so that the default browser tooltip is supressed. Even for those elements not grabbing content from the title attribute itself, it needs to be removed, or in the case of qTip, renamed, so that we don't get two tooltips showing up!
关于jquery - 好奇为什么 <div title=***> 在我使用 jQuery .css 后变成了 oldtitle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10980821/