1

下面的 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
  });
});
4

2 回答 2

0

在您的 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
});
于 2010-10-05T07:17:22.093 回答
0

我在每个链接之外的 < td > 中添加了一个 id “pr-cell”,并应用于所有 < a > 标签,每个链接都有一个唯一的 id,感谢您的帮助。

$('#pr-cell > a').live('mouseover', function(e) {
    $('#pr-cell > a').not('.hasToolTip')
    .addClass('hasToolTip')
    .tooltip({
        track: true,
        delay: 0,
        opacity: 0.9,
        showURL: false,
        showBody: " - ",
        extraClass: "pretty",
        fixPNG: true,
        left: -120
    });
});
于 2010-10-05T09:53:21.577 回答