Please take a look at this:
http://jsfiddle.net/tmPfV/
If you right-click, the window will be moved to the right, and if you click on the left, the window will move to the left. However, if you right-click again, nothing ...
How can I make him move left and right as many times as I like and not work for one round and then not work again?
Also, if you press the clock first and then right, it will also go bad, how to solve it?
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>
Remy source share