Tooltipser弹出窗口不适用于第一个鼠标悬停

时间:2014-04-08 08:15:17

标签: jquery tooltipster

我在页面中使用了Tooltipser弹出窗口。

tooltipser的内容正在由ajax更新。

如果内容中没有图像,它们运行良好。

但是如果ajax内容中有图像,则第一次tooltipser的位置不正确。 但从第二次起,它出现在正确的位置(即在最高位置)

任何人都知道原因吗?

以下是我的代码

<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'>";
?>

1 个答案:

答案 0 :(得分:1)

这在github问题列表中得到了解答。 https://github.com/iamceege/tooltipster/issues/111

相关问题