J Ward
J Ward

Reputation: 21

Object doesn't support this property or method IE8

I am getting an error in IE8: Object doesn't support this property or method yet everything works in the other browsers no problem. When IE is refreshed the error goes away and the slideshow displays properly.

Here is the code.

$(window).load(function(){
  $('.flexslider').flexslider({
    animation: "slide",
    start: function(slider){
      $('body').removeClass('loading');
    }
  });
});

The line causing the error is $('.flexslider').flexslider({

I've tried various solutions to no avail. Any suggestions?

Upvotes: 1

Views: 9478

Answers (2)

J Ward
J Ward

Reputation: 21

Found the answer and it wasn't in the line of code I posted. I was using

<script defer src="scripts/jquery.flexslider.js"></script>

to load the script and I changed it to

<script src="scripts/jquery.flexslider.js"></script>

Everything works fine now.

Upvotes: 1

Joe Enzminger
Joe Enzminger

Reputation: 11190

$(function() {
    $(window).load(function() {
        $('.flexslider').flexslider({
          animation: "slide",
          start: function(slider){
          $('body').removeClass('loading');
         }
    });
});

This makes use of jQuery.ready(), which is more reliable than $(window).load() cross-browser.

In fact, you can replace $(window).load() altogether (if you don't need to wait for images or etc).

$(function() {
    $('.flexslider').flexslider({
        animation: "slide",
        start: function(slider){
        $('body').removeClass('loading')
    }
});

Also, make sure the script that includes the flexslider is included in the "head" section of your page. If you include it in the body or load it by creating a DOM node, neither load nor ready will guarantee that it has been executed.

Upvotes: 0

Related Questions