我似乎在使用 jQuery 在 IE 中创建简单的缩放时遇到了一些问题。在 Firefox 中一切都很好,但大多数用户报告 IE 不稳定。
我已经禁用了 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>
任何帮助将不胜感激。很高兴向某人发送一些免费卡的代码!
谢谢,亚当