count = 0;
total = 2;
jQuery("#slide").everyTime(5000,function(i){
if(count == total-1) {
count = 0;
jQuery(this).stop().animate({backgroundPosition: "0px 0"}, {duration:1000});
}
else{
jQuery(this).stop().animate({backgroundPosition: "-"+950*count+"px 0"}, {duration:1000});
count++;
}
});
Hi all, i am trying to work on this. there are some problem with the “950*count”. When ever i put an operator into this, it wont’ work, but if i remove the *count, it work just fine.
Can someone point out what the problem is?
Thank you
Put parentheses around the calculation:
Otherwise the expression is evaluated from left to right, first concatenating
"-"with"950", then trying to multiply that.