jquery - 使用 jquery 加载事件在 IE 8 中失败

标签 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);
                }
            });
        });

错误提示:对象不支持属性或方法。

我做错了什么?

谢谢

最佳答案

首先设置load处理程序,然后设置src

fullImage.bind('load', function() {
   ...
}).attr('src', fullImageUrl);

关于jquery - 使用 jquery 加载事件在 IE 8 中失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4921712/

相关文章:

javascript - 这行代码的作用是什么? var foo = documentGetElementById( form_name ).elements;

jquery slider 在 ie8 及以下版本中不运行

javascript - JQuery 比较数组中的任何匹配项

javascript - jQuery - 有没有办法测试一个函数是否是异步的?

javascript - $.each 内的异步错误处理

jquery - 进度完成时加载网站

javascript - 检查按钮单击时输入字段值是否已更改

javascript - Fine Uploader - 未从加载的 iframe 收到有效消息

JQuery 验证在 IE8 中不起作用

html - Internet Explorer 8 将我的网页显示为空白页,但在开发人员工具中没有显示任何问题