【问题标题】:assign tooltip behaviour to repeating links将工具提示行为分配给重复链接
【发布时间】:2011-04-21 03:55:04
【问题描述】:

下面的 HTML 是通过 ajax 调用“purchase_content”生成的。我想将工具提示应用于每一行中的每个链接,最多可以是 100 行。

这是目前的代码,但没有成功。如果我将每个链接翻转两次,则会出现工具提示,但不会再次出现。对每行上的链接地址有何想法?

<div id="purchase_content">
  <div id="pr-listing">

  <div id="pr-odd">
    <table width="950" height="100" border="0" cellpadding="0" cellspacing="0">
      <tr><td width="75" align="center" valign="middle">
        <a href="#" id="avlink" title="3-5 Working Days">5-7 Days</a>
      </td></tr>
    </table>
  </div>

  <div id="pr-even">
    <table width="950" height="100" border="0" cellpadding="0" cellspacing="0">
      <tr><td width="75" align="center" valign="middle">
        <a href="#" class="avlink" title="3-5 Working Days">Available Now</a>
      </td></tr>
   </table>
  </div>

  </div>
</div>

$('a.avlink').live('mouseover', function(e) {
  var target = $(e.target);
  return $(target).tooltip({
    track: true,
    delay: 0,
    opacity: 0.9,
    showURL: false,
    showBody: " - ",
    extraClass: "pretty",
    fixPNG: true,
    left: -120
  });
});

【问题讨论】:

    标签: jquery ajax dynamic tooltip repeat


    【解决方案1】:

    在您的 ajax 成功处理程序中,尝试添加类似的内容,

    $('a.avlink').not('.hasToolTip') // hasToolTip with a dot in it
    .addClass('hasToolTip')   // hasToolTip without a dot in it
    .tooltip({
        track: true,
        delay: 0,
        opacity: 0.9,
        showURL: false,
        showBody: " - ",
        extraClass: "pretty",
        fixPNG: true,
        left: -120
    });
    

    【讨论】:

    【解决方案2】:
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-10-23
    • 1970-01-01
    • 2021-06-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多