• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stop jQuery animation in progress.

 
William Rouse
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65124
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
.stop()
 
William Rouse
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That ease Mr. Bibeault, thank you. I guess I can now move on to the hard part and write a continous loop.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65124
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure why you fee that you need a loop. You can just queue up the animations.
 
William Rouse
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear:
I got to learn new ways to think, I guess. Let me grab your book from a box (I'm in the middle of a slow move) and see how to do that. Thanks for the clues.
 
William Rouse
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried this experiment in the file listed below. It is some progress but not at all what I expected. I can't stop it or reset it. The div hesitates before it starts.
Do you think I am on the right track? I started to read about queues to see if I need to purge something.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic