0

HTMLをDivに取り込むAjax呼び出しを行っています。私が持っているdivの中に

タイトル付きのテキスト。次に、そのタイトルをツールチップに使用します。

$.ajax({
    url: '/feedme.aspx',
    success: function (data) {
        $('#liveContent').html(data);
        $("#liveContent .liveReader").tooltip({ tipClass: 'tool-tip' });

    }
});

ajax呼び出しから返されるコンテンツは

<div id="liveContent">
    <div id="item1" class="liveReader" title="item 1"><p>Text 1</p></div>
    <div id="item2" class="liveReader" title="item 2"><p>Text 2</p></div>
</div>

ツールチップは機能しますが、コンテンツが更新されると、ツールチップは画面に表示されたままになります。フィードを更新する前にツールチップを削除するにはどうすればよいですか?

私は以前にMootoolsでこれを実際に行ったことがありますが、それを使用するために移動したばかりのjQueryでそれを行うためのコードを見つけることができません。

助けてくれてありがとう!

4

3 に答える 3

1

ツールチッププラグイン(使用しているプラ​​グインはわかりません)は、おそらくbodyタグの最後に別のdivを追加します。IDはおそらくtooltip。です。ajax成功コールバックの最初のステップは、このdivを非表示/削除することです。

于 2012-06-26T14:43:02.640 に答える
0

It looks like that there are two 'div's added when you hover the div with the tool tip. Adding these two line prior to the Ajax call fixed the problem for me:

$('.tooltip-inner').remove();
$('.tooltip-arrow').remove();
于 2013-12-18T22:52:17.330 に答える
0

fwiw - I had the same issue. Best approach is to wait till the tooltip bubble is stuck, then use inspect element (chrome, firebug) and find the name of the element and simply do a remove from there before any following removes . for example (mine was #tooltip):

$("#tooltip").remove();
/* rest of code here */
于 2015-04-16T06:13:25.647 に答える