【发布时间】:2014-04-08 08:15:16
【问题描述】:
我在我的页面中使用 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'>";
?>
【问题讨论】:
标签: jquery tooltipster