0

I have a jQuery image gallery script that works fine on all browsers except in Internet Explorer. I get the error

Object doesn't support this property or method.

I looked this up, and it seems this is normally caused by variables and code elements with the same name. I don't see any overlap in my code though. The error says it is located in this code:

// 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);
    });
4
  • What exact object does not support property? Commented Jul 30, 2012 at 17:26
  • options.onClick.apply(this, [event, pict.get()]); - I guess options doesn't have an onClick event handler yet, and therefore since it's a null reference instead of a function reference, it doesn't have apply. Try $(options).click() instead to simulate the event. Commented Jul 30, 2012 at 17:27
  • what version(s) of IE are you testing? Commented Jul 30, 2012 at 18:49
  • IE is saying the error occurs on the first line of this code. @Spudley I'm checking IE8 and earlier. Commented Jul 31, 2012 at 12:34

1 Answer 1

1

As it turns out there was a double script being included in the page. (Site was not originally designed by me) This was apparently causing the problem. I removed the script and all is running fine.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.