2010-11-30 6 views
0

マウスの高速移動(いつものようにIEのみ)では、両方のホバーハンドラーがトリガーされるため、何も表示されません。 hoverIntendを使用しようとしましたが、そのプラグインがe.pageX/Yで混乱しています これを修正する方法があれば、5時間後には成功しませんでした。マウスを動かすと、Jqueryのホバーが両方のハンドラーを起動します

yOffset = 10; 
xOffset = 30;  

$("img.hover-preview").hover(function(e){ 
//alert('hover'); 

this.t = this.title; 
this.title = ""; 
var c = (this.t != "") ? "<br/>" + this.t : ""; 

preview_link = $('#' + this.id + '-url').attr('src'); //Get the src of the bigger preview image 
zoom_link = $('#' + this.id + '-url-zoom').attr('src'); //Get the src of the ZOOM image 

//Output of the preview element 
$("body").append("<div id='hover-preview-active'><img src='"+ preview_link +"' alt='Loading Image Preview' /><span>" 
       + Drupal.t("Press and hold Z key to zoom") + "</span></div>");  

$("#hover-preview-active") 
    .css("top", (e.pageY - yOffset) + "px") 
    .css("left",(e.pageX + xOffset) + "px") 
    .fadeIn("fast"); 
}, 

function(){ 
    this.title = this.t; 
    $("#hover-preview-active").remove(); 
}); 
+0

どのように機能しますか? –

+0

それはadityaからの解決策と一緒に働いています –

答えて

0

あなたのホバーアウト機能でこれを行うことができます。それが呼び出されたときに、あなたの#hover-preview-activeがアニメーション化された場合に実行されるから機能を停止します

function(){ 
    if($("#hover-preview-active").is(":animated")) 
     return; 

    this.title = this.t; 
    $("#hover-preview-active").remove(); 
}); 

関連する問題