williamrouse Posted November 1, 2009 Report Share Posted November 1, 2009 In playing with jQuery to understand it better in a doing way, I made a project for myself to have a square move from right to left in the browser and then back again. So far I was able to make a function that does one iteration and another that resets the square but before I try to understand how to keep the loop continuously I was hoping to write code to stops the animation with another click event, but don?t know how to do that. If you can please point me where to look for clues? Here is the code I have written so far. $(document).ready(function(){ $("#start").click(function(){ $("#block").animate({"left": "500px"}, "slow") .animate({"left": "25px"}, "slow") }); $("#reset").click(function(){ $("#block").css({top:"150px", left:"25px", borderWidth:""}); }); $("#stop").click(function(){ }); }); Quote Link to comment Share on other sites More sharing options...
falkencreative Posted November 1, 2009 Report Share Posted November 1, 2009 I believe this is what you are looking for... http://docs.jquery.com/Effects/stop Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.