AJAX を使用して動的に生成されたコンテナーのホバー時にTooltipsterプラグインを使用してツールチップを追加しようとしています。私はこれに非常に苦労しており、これを何日も理解しようとしています。注: エラーは発生していません。Tooltipster は ajax 以外の要素に取り組んでいます。
これを実装する方法についての提案に感謝します。
よろしくお願いします!
JavaScript / AJAX 呼び出し
$.ajax({
url: "get-data.php?bestItems=1",
dataType: "html",
success: function(data){
$(".best-items-container").html(data).show();
}
});
ツールチップの初期化 / イベント
$('.best-item-option').tooltipster({
custom: 'hover',
onlyOne: true, // allow multiple tips to be open at a time
position: 'left', // display the tips to the left of the element
theme: '.my-custom-theme'
});
$(document).on('hover', '.best-item-option', function(){
$('.best-item-option').tooltipster('show');
});
動的 HTML スニペット (PHP)
<div class="best-items-container">
<div class="best-item-option" title="Testing Tooltip">
<div class="hotItemName">'. $data['name'][$i].'</div>
</div>
</div>