Tuesday, 27 August 2013

putting the right setTimeout function on jquery

putting the right setTimeout function on jquery

There seems to be a problem with setTimeout function. The colors don't
change. Please check fiddle below. Thanks.
http://jsfiddle.net/qU6t6/6/
var delay = 0;
for(var i = 0; i<=5; i++){
setTimeout(function(){
$('#productimage').addClass('step' + (i+1));
},delay);
delay += 2500;
}

No comments:

Post a Comment