ID の配列を使用する必要がありますか? すべてのヒント コンテナとコンテンツ要素にクラスを設定する方がよいと思います。これは、FloatingTips()
. 例えば:
<div class="tipContainer">
<p>A second tip</p>
<p><a href="#">Let me see!</a></p>
<div class="tipContent" style="display: none;">
<p>Here is another tip.</p>
</div>
</div>
<div class="tipContainer">
<p>A second tip</p>
<p><a href="#">Let me see!</a></p>
<div class="tipContent" style="display: none;">
<p>Here is another tip.</p>
</div>
</div>
への更新された呼び出しにFloatingTips
は、HTML で設定されているように、tipContainer および tipContent クラスへの更新された参照が含まれます。コンテンツをプルする関数が少し変更され、'tipContent' クラスの要素内のコンテンツを検索するようになりました。
new FloatingTips('.tipContainer', {
// Content can be a string (an attribute name) or a function.
// If it's a function, it can returns string or HTML elements.
content: function(tipContainer) {
return $(tipContainer).getElement('.tipContent');
},
html: true, // I want that content is interpreted as HTML
center: false, // I do not want to center the tooltip
arrowOffset: 16, // Arrow is a little more the the right
offset: { x: 10 }, // Position offset {x, y}
position: 'bottom',
});
これが実際の例です - http://jsfiddle.net/pH3BB/1/
お役に立てれば!
クレイグ