luk*_*sak 10 jquery internet-explorer-8
我写了一个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);
}
});
});
Run Code Online (Sandbox Code Playgroud)
错误说:对象不支持属性或方法.
我究竟做错了什么?
谢谢
RoT*_*oRa 49
首先设置load处理程序,然后设置src.
fullImage.bind('load', function() {
...
}).attr('src', fullImageUrl);
Run Code Online (Sandbox Code Playgroud)