jt类不能执行多次

时间:2013-01-28 16:46:21

标签: javascript jquery

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

html代码:

<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" />'
});

但是当我想在课堂上使用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无法加载工具提示

2 个答案:

答案 0 :(得分:0)

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

摆脱选择器中的“:eq(0)”。

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

答案 1 :(得分:0)

Pointy是对的,你的代码中的eq将匹配元素的集合减少到指定索引处的元素。 这就是为什么你无法捕捉所有元素。

相关问题