Im following Jeffrey ways excellent learn jquery in 30 days on youtube, but I cant get the slider to work using his code. which stems down to the imgWidth variable not being set correctly when the variables are set at the top of the script.
images = sliderUL.find('img'),
imagesLen = images.length,
current = 1,
imgWidth = images[0].width; // giving 0 instead of 600??
It gets 0, However if I console.log the images[0].width further down the script when a button is clicked it shows the correct value of 600. Its as if the dom isn't ready at the time of the first assignment or it does the assignment before the images width is known? can somebody tell me whats going on? I tried wrapping the whole thing in a document ready function just in case that was the issue, but it still doesn't work