Before i tear my hair out and go down the wrong path in terms of debugging. Can someone confirm that this code will do as intended. Ie. animate 5 divs to different positions:
var i, j, k;
$('#menuButton').click(function(){
for (i=1; j=0; k=150; i<=5; i++; j+=30; k-=30){
$('.spinner #item' + i).animate({
left: '+=' + j,
bottom: '+=' + k
}, 500, function() {
// Animation complete.
});
}
});
When i click the #menuButton, nothing happens and I get this error:
Uncaught SyntaxError: Unexpected token ; on the 'for()' line...
,between variable assignments. The;are for separating the initial assignment, condition, and the expression to run after each iteration.bottom : '+=' + (i * -30 + 150). It's like they teach you in algebra in High School for the equation of a line :)...ax+c(wherecis your constant andais your slope/rate)