I have 2 variables
var firstThumb = 2;
var thumbRel = "0" + firstThumb;
This sets the number for my first thumbnails rel attribute rel="02" - I like things looking nice, there are 15 thumbs so it just makes my code line up and look nicer. That's the reason for the 0.
I have a function.
function thumbIncrease() {
firstThumb++
};
this runs in an interval - Every 2 seconds.
setInterval(function(){
thumbIncrease();
console.log(firstThumb);
console.log(thumbRel);
}, 2000);
the console log for firstThumb increases as expected - 2, 3, 4, 5 and so on every 2 seconds.
BUT - The console log for thumbRel stays at 02 every time and doesn't increase
So I guess thumbRel isn't updating when firstThumb does for some reason?
Could anybody help with this?
Thanks!!