JT类不超过一次

jt class not excute more than one time

本文关键字:一次 不超过 JT      更新时间:2023-09-26

我使用 http://plugins.learningjquery.com/cluetip 插件和 jtip 类

网页代码:

<a class="jt" href="ajax6.html" rel="ajax6.html" title="jTip Style!">
and jquery :
$('a.jt:eq(0)').cluetip({
  cluetipClass: 'jtip',
  arrows: true,
  dropShadow: false,
  hoverIntent: false,
  sticky: true,
  mouseOutClose: true,
  closePosition: 'title',
  closeText: '<img src="cross.png" alt="close" />'
});

但是当我想在 JT 班使用 2 个或更多时间时,只是头等舱工作例如:

<a class="jt" href="ajax6.html" rel="ajax6.html" title="jTip Style!">
<a class="jt" href="ajax5.html" rel="ajax5.html" title="jTip Style!">

仅加载 ajax6 并显示工具提示,而 ajax5 未加载工具提示

这是因为您的代码明确指示它仅适用于第一个<a>

去掉选择器中的":eq(0)"。

$('a.jt').cluetip({ ...

Pointy 是正确的,代码中的 eq 将匹配元素集减少到指定索引处的元素集。这就是为什么你不能抓住所有元素。