IE8 Error

IE8 Error

I have a stupid IE problem now. When running my site in IE8 it throws this error:

Line: 4166
Error: Could not get the position property. Invalid argument.

Here is the code in question:

    var nextPage = function(){
     currentPage++;
     
     var row = 0;
     var col = 0;
     
     var newStart = currentPage*perPage;
     var newEnd = (currentPage*perPage)+perPage-1;
           
     $('ul.gallery li').slice((currentPage*perPage),((currentPage*perPage)+perPage))
     .each(function(i){
      var actual = (perPage+i)*currentPage;
      var imgWidth = $("img", this).width();
      var imgHeight = $("img", this).height();
      $(this).css({'left' : 0-imgWidth, 'top' : (gHeight-imgHeight)/2, 'position' : 'absolute'});
      var setLeft = $.randomBetween((col*iMWidth),(((col*iMWidth)+iMWidth)-imgWidth));
      var setTop = $.randomBetween((row*iMHeight),(((row*iMHeight)+iMHeight)-imgHeight));
      $("img", this).fadeIn('slow');
      $(this).animate({'left' : setLeft, 'top' : setTop}, 'slow');
      col++;
      if(col>=numCols){
       col = 0;
       row++;
      }
     });
     $('ul.gallery li').slice(((currentPage-1)*perPage),(((currentPage-1)*perPage)+perPage))
     .each(function(i){
      var actual = (perPage+i)*(currentPage-1);
      var imgWidth = $("img", this).width();
      var imgHeight = $("img", this).height();
      $(this).animate({'left' : gWidth, 'top' : (gHeight-imgHeight)/2, 'position' : 'absolute'});
      $("img", this).fadeOut("slow");
     });
    };

I don't have the slightest idea whats wrong as it works perfectly in FF and a google search turned up nothing.
    • Topic Participants

    • dan