Reputation: 122
how would I would I write
If (margin-top for #ted = 100px)
then
(.animate #ted margin- top: 20px)
else
(.animate #ted margin- top: 50px)
Can this be done and if so can you show me how? Thank You for all the help!
Upvotes: 0
Views: 2325
Reputation: 735
It would be something like this:
var ted = $('#ted');
if (ted.css('margin-top') === '100px') {
ted.animate({'margin-top' : '20px'});
}
else {
ted.animate({'margin-top' : '50px'});
}
Good luck!
Upvotes: 2