关于jQuery代码的Internet Explorer错误帮助

Internet Explorer error help on jQuery code

本文关键字:Explorer 错误 帮助 Internet jQuery 代码 关于      更新时间:2024-04-29

我有一个jQuery图像库脚本,它在除Internet之外的所有浏览器上都能正常工作;探索者我得到错误

对象不支持此属性或方法。

我查了一下,似乎这通常是由同名的变量和代码元素引起的。不过,我在代码中没有看到任何重叠。错误表明它位于以下代码中:

// Append new picture
jQuery('<img />')
    .attr('src', p)
    .attr('id', pid)
    .css({
        position: 'absolute',
        top: 0,
        left: 0,
        opacity: 0.0
    })
    .bind('click.gallery', function (event) {
        options.onClick.apply(this, [event, pict.get()]);
    })
    .appendTo('#' + id)
    .animate({opacity: 1.0}, {
        queue: false,
        duration: duration,
        easing: 'linear'
    })
    .load(function () {
        pict.data('loaded', true);
    });

事实证明,页面中包含了一个双脚本。(网站不是我最初设计的)这显然是造成问题的原因。我删除了脚本,一切都很顺利。