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();
});
你想如何工作? – 2010-11-30 21:10:04