1

我正在使用 jQuery Tooltip 1.3 和 jQuery 1.7。当我向锚标记添加标题属性时,工具提示功能;但是,当我尝试使用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 
      }
    );
   }
4

2 回答 2

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 
      }
    );
   }

希望这行得通……穆罕默德。

于 2012-10-17T14:30:38.797 回答
0

对不起大家。这是由于与 bootstrap.js 的冲突,它也使用 tooltip() 但没有bodyHandler.

谢谢。

于 2012-10-17T14:55:29.973 回答