1

私のページで Tooltipser ポップアップを使用しています。

また、tooltipser の内容は ajax で更新しています。

コンテンツに画像がない場合、それらはうまく機能しています。

ただし、ajax コンテンツに画像がある場合、最初のツールヒントの位置は正しくありません。しかし、2回目以降は正しい位置(つまりトップ位置)になります。

誰でも理由を知ることができますか?

以下は私のコードです

<script>

$(document).ready(function() {
$('#test_link').tooltipster({
    interactive:true,   
    content: 'Loading...',
    functionBefore: function(origin, continueTooltip) {

        // we'll make this function asynchronous and allow the tooltip to go ahead and show the loading notification while fetching our data
        continueTooltip();

        // next, we want to check if our data has already been cached
        //if (origin.data('ajax') !== 'cached') {
            $.ajax({
                type: 'POST',
                url: 'example.php',
                success: function(data) {
                    // update our tooltip content with our returned data and cache it
                    origin.tooltipster('content', $(data)).data('ajax', 'cached');
                }
            });
      //  }
    }
});
     });
    </script>

example.php

<?php
echo "<img src='flag.jpg'>";
?>
4

1 に答える 1

1

これは、githubの問題リストで回答されています。https://github.com/iamceege/tooltipster/issues/111

于 2014-04-08T09:57:23.683 に答える