2014-04-08 81 views
1

我在我的頁面中使用了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'>"; 
?> 

回答

相關問題