Reputation: 18550
I can't figure out to animate marginLeft with jQuery. I need it to subtract 938px every time a user clicks on a link, which was working fine when I was using .css()
, but I can't figure out how to make it work with .animate()
.
$("#full-wrapper #full").animate({
marginLeft, -=938px
}, 500);
Can anyone figure out why this doesn't work? This was my CSS version:
$("#full-wrapper #full").css("marginLeft","-=938px");
I was using CSS3 for animation, but need to make it work in older browsers.
Upvotes: 23
Views: 67498
Reputation: 69915
Replace comman(,) by colon(:).
$("#full-wrapper #full").animate({
marginLeft: "-=938px"
}, 500);
Upvotes: 3
Reputation: 337714
There's a syntax error in your code, as you are passing parameters in an object to animate()
you should use :
not ,
to delimit each attribute. Try this:
$("#full-wrapper #full").animate({
marginLeft: '-=938px'
}, 500);
Upvotes: 49