在IE 8中,使用jquery的load事件失败 [英] load event with jquery fails in IE 8
本文介绍了在IE 8中,使用jquery的load事件失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我写了一个jquery插件来向上缩放图像。在ie 8中,大图像的加载事件失败。我尝试过像:
i've written a jquery plugin to scale a image up an back down. in ie 8 the load event of the large version of the image fails. i tried like thsi:
var fullImage = container.find(options.fullSelector);
fullImage.attr('src', fullImageUrl).bind('load', function() {
content.fadeOut(options.fadeSpeed, function(){
if(slideContent.size()){
slideContent.slideUp(options.resizeSpeed, function(){
smallImage.hide();
fullImage.show();
fullImage.parent().andSelf().stop().animate({ width: options.fullWidth + 'px' }, options.resizeSpeed);
});
}
else{
smallImage.hide();
fullImage.show();
fullImage.parent().andSelf().stop().animate({ width: options.fullWidth + 'px' }, options.resizeSpeed);
}
});
});
错误说明:对象不支持属性或方法。
the error says: Object doesn't support property or method.
我做错了什么?
谢谢
推荐答案
首先设置 load
处理程序,然后设置 src
。
Set the load
handler first, then set the src
.
fullImage.bind('load', function() {
...
}).attr('src', fullImageUrl);
这篇关于在IE 8中,使用jquery的load事件失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文