Jump to content

Error: Unable to get property 'length' of undefined or null reference


Blueie

Recommended Posts

Hello

 

I am getting the above JavaScript error with fading images in an ASP.NET project.

 

I do not know what causes the error or how to correct it. There are no images on the Web page at the moment, only a link to the JavaScript file that contains the error below:

 

 

 

function gallery() {  //if no images have the show class, grab the first image  var current = ($('ul.slideshow li.show')?  $('ul.slideshow li.show') : $('#ul.slideshow li:first'));  // trying to avoid speed issue  if(current.queue('fx').length == 0) {     // get the next image, if it reached the end of the slideshow, rotate it back to the first image    var next = ((current.next().length) ? ((current.next().attr('id') == 'slideshow-caption')? $('ul.slideshow li:first') :current.next()) : $('ul.slideshow li:first'));         // get the next image caption    var desc = next.find('img').attr('alt');      // set the fade in effect for the next image, show class has higher z-index    next.css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 1000);       // hide the caption first, and then set and display the caption    $('#slideshow-caption').slideToggle(300, function () {      $('#slideshow-caption p').html(desc);      $('#slideshow-caption').slideToggle(500);    });       // hide the current image    current.animate({opacity: 0.0}, 1000).removeClass('show');  }}

 

Thank you for any advice.

 

Blueie

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...