I have a function which loops through 28 images.
The first images are 1234jd01.jpg
and then 1234jd02.jpg
all the way to 09.jpg
After the loop has gone from 01
to 09
it should go to 10
, 12
and all the way up 28
and then loop back.
However my code just does 1,2,4 - 9
and then 10, 11
which works.
Can I add a 0
to the first set if it is a single digit and then stop at 28? So the first block of images is not showing as missing?
jsFiddle is: http://jsfiddle.net/khaleelm/Vv2u3/2/
My code is
$(function () {
var i = 01;
var interval = setInterval(function () {
jQuery('.animationMax img').attr({
src: 'http://jdsports.scene7.com/is/image/JDSports/127932jd' + i + '?hei=255&wid=427&resmode=sharp&op_usm=1.1,0.5,0,0&defaultImage=JDSports/sizeImageMissing'
});
i++;
if (i === 28) i = 01; //38 images has been shown, stop the interval
}, 100);
});