2010-02-02 33 views
1

我似乎有一些問題,使用jQuery創建一個簡單的放大IE。在Firefox中一切都很好,但大多數用戶報告稱IE瀏覽器不穩定。jQuery圖像/懸停預覽導致在IE7中的Ch Behavior行爲

我已禁用IE中的代碼(使用jQuery.browser.msie),但如果可能的話,會愛上任何人的幫助。

我的jquery源代碼如下(忽略支持功能)。

this.imagePreview = function(){ 
/* CONFIG */ 

    xOffset = 10; 
    yOffset = 20; 

    // these 2 variable determine popup's distance from the cursor 
    // you might want to adjust to get the right result 

/* END CONFIG */ 
$("a.preview").hover(function(e){ 
    this.t = this.title; 
    this.title = ""; 
    this.inside = $(this).attr('inside') 
    this.outside = $(this).attr('outside') 
    var c = (this.t != "") ? "<br/>" + this.t : ""; 
    $("body").append("<p id='preview'><img width='260' src='"+ this.inside +"' />"+ c +"</p>");   
    $("#preview") 
    .css("top",(e.pageY - xOffset) + "px") 
    .css("left",(e.pageX + yOffset) + "px") 
    .fadeIn("fast");  
    }, 
function(){ 
    this.title = this.t; 
    $("#preview").remove(); 
    }); 
$("a.preview").mousemove(function(e){ 
    $("#preview") 
    .css("top",(e.pageY - xOffset) + "px") 
    .css("left",(e.pageX + yOffset) + "px"); 
}); 
}; 
$(window).load(function(){imagePreview();}); 

下面是一個有問題的網頁示例:http://www.engreet.com/CategoryDetail.aspx?cid=17。如果您滾動到源代碼,你會看到縮略圖在使用像這樣的代碼裏面有側翻/懸停預覽:

<a href="/CardDetailFull.aspx?cid=670" outside="http://static.engreet.com/ArtistFiles/51/Happy_Bela_Front_633998103802577482.jpg" inside="http://static.engreet.com/ArtistFiles/51/Happy_Bela_InsideRight_633998103832264982.jpg" title="Inside Preview" class="preview"> 
<img src='http://static.engreet.com/ArtistFiles/51/_128X178_Happy_Bela_Front_633998103802577482.jpg' alt="" width="128" /> 
</a> 

任何幫助,將不勝感激。很高興向某人發送一些免費卡片的代碼!

謝謝, 亞當

+0

這裏沒有Windows測試,但是:其他懸停示例如何爲那些抱怨您的實現工作?像http://www.sohtanaka.com/web-design/fancy-thumbnail-hover-effect-w-jquery/? – Arjan 2010-02-02 22:29:19

+0

而且:「波濤洶涌」是什麼意思?可以http://www.learningjquery.com/2009/01/quick-tip-prevent-animation-queue-buildup幫助嗎? – Arjan 2010-02-02 23:41:25

回答

1

問題最終是正被重複透明背景PNG圖像。這是1x1和填充755x600方形帆布。通過增加到25x25,所有問題都解決了。通過影響jQuery最終導致問題一直是IE的瘋狂渲染,這個問題是如何顯示出來的!

希望這可以幫助未來的人。