Please take a look at this:
If you click right the box moves right and if you click left the box moves left. However if you click right again, nothing...
How can I get it to move right and left as many times as I like instead of it working for one round and then not working again?
Also if you clock left first and then right it also messes up, how to solve that?
jquery:
$('.right').click(function(e) {
e.preventDefault();
$('#foo').animate({
'right' : '30px'
});
});
$('.left').click(function(e) {
e.preventDefault();
$('#foo').animate({
'left' : '30px'
});
});
html:
<a href="" class="left">left</a> | <a href="" class="right">right</a>
<br /><br />
<div id="foo" style="background:red;width:100px;height:100px;position:absolute"></div>