我正在使用jQuery Tooltip 1.3和jQuery 1.7。当我为我的锚标签添加title属性时,工具提示功能;但是,当我尝试使用bodyHandler
时,它无效。我无法在bodyHandler
函数中向控制台记录任何内容,这让我相信它永远不会被调用。
HTML:
<a href="#awrap-exhibitor-listing" class="em-tooltip tooltip-directory" data-original-title="">View how your listing will appear in the directory:</a>
<div id="awrap-exhibitor-listing" class="wrap-exhibitor-listing" style="display: none; ">
<div class="em-show-directory-example">
<div class="sd-company-booth">
<div class="sd-company display-inline-block">1st Guard Corporation</div>
<div class="sd-booth display-inline-block float-right">12093</div>
</div>
<div class="sd-address">200 Nokomis Avenue South, 4th Floor</div><div class="sd-locale">Venice, Florida 34285</div>
<div class="sd-phone">(800) 995-4827</div>
<div class="sd-name">Courtney Wilson</div>
<div class="sd-phone">www.1stguard.com</div>
<div class="sd-product">
<strong>WILL DISPLAY:</strong> INSURANCE FOR LEASED OWNER OPERATORS - PHYSICAL DAMAGE, NONTRUCKING LIABILITY AND OCCUPATIONAL ACCIDENT INSURANCE
</div>
</div>
<div class="em-el-categories">Your listing will display alphabetically and under the following categories: <span class="em-el-category">Insurance</span>
</div>
</div>
JS:
Drupal.tooltipDirectoryListing = function() {
$('.wrap-exhibitor-listing').hide();
$('.tooltip-directory').tooltip(
{
bodyHandler: function() {
return $($(this).attr("href")).html();
},
showURL: false
}
);
}
答案 0 :(得分:0)
只需将$
替换为jQuery
您的代码应该是那样的
Drupal.tooltipDirectoryListing = function() {
jQuery('.wrap-exhibitor-listing').hide();
jQuery('.tooltip-directory').tooltip(
{
bodyHandler: function() {
return jQuery(jQuery(this).attr("href")).html();
},
showURL: false
}
);
}
希望这有效......穆罕默德。
答案 1 :(得分:0)
对不起所有人。这是由于与bootstrap.js的冲突,它也使用tooltip()但没有bodyHandler
。
感谢。