我写了一个 jquery 插件来放大和缩小图像。在 ie 8 中,大版本图像的加载事件失败。我尝试过这样的:
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);
}
});
});
错误提示:对象不支持属性或方法。
我做错了什么?
谢谢
最佳答案
首先设置load
处理程序,然后设置src
。
fullImage.bind('load', function() {
...
}).attr('src', fullImageUrl);
关于jquery - 使用 jquery 加载事件在 IE 8 中失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4921712/