2011-08-26 91 views
0

我有一個動態加載的iframe。我希望qtips在用戶將鼠標懸停在某些元素上時顯示,並且qtips將在元素內一次跟隨光標。我無法使用選項target: 'mouse',因爲iframe中的qtips固定位於父容器。我得到了一些有用的東西,除了提示仍然離開我的光標,只在y軸上,在FF中,距離最遠,IE最接近。我知道這不是實現它的正確方式,所以任何幫助表示讚賞。謝謝!qTip2裏面的iframe檢測mouseenter&mousemove

$("#pageFrame").load(function() { 
    var pageFrameContent = $(this).contents()[0]; 
    $("div.extra", pageFrameContent) 
    .mouseenter(function(){ 
    $(this).mousemove(function(e){ 
     $(this).qtip({ 
       position: { 
        target: [e.screenX,e.screenY] 
       }, 
       show: { 
        solo: true, 
        ready: true, 
        delay: 0 
       }, 
       hide:{ 
        event: 'click mouseleave'    
       }, 
       content: 'Tips content', 
       style: 'ui-tooltip-shadow ui-tooltip-rounded' 
     }); 
    }); 
}); 
}); 
+0

我設法通過使用'target:[e.clientX,e.clientY]來解決流離失所的問題'但我還是想知道mouseenter和mousemove是否會影響性能...... –

回答

1

Craig在qTip2 forum上回答了這個問題。事實證明,如果您可以在iframe中創建提示,這是最好的選擇。