Stop Effects and Animations

2 minutes
Share the link to this page
Copied
  Completed
The jQuery stop() method is used to stop an animation or effect before it is finished. The stop() method works for all jQuery effect functions, including sliding, fading and custom animations.

Transcript

Hello, in this jQuery video, I am going to show you the stop method in relation to effects. This allows you I think you can guess, drum roll to was my attempt to drum roll animations or affect the library to you know, just stop them before they have completed these animation or here, you know the exact animation doesn't actually matter, or the exact effect this principle is the same. So what I'm going to do is create a little button and this one is done, please stop this stop button. And I just want to detect when it has been clicked. I can do so using this code and slightly modifying it. Right yeah.

At actually using code, get hold All the element that you want to stock information on. So it'll be essentially the same selector that you use to, you know, start the effect of the animation. So that dot stop, and that is literally, it couldn't be simpler. And now if we will to learn. So, it is pretty darn fast To be fair, so let's actually add a screen parameter. So this will be four seconds.

So for five milliseconds, I say animate. Okay, this works. If I click that, and if I click the Stop button, and if we stopped in there, we can you make the ganzfeld relative to where it is currently. Click stop, it stops it. So that's all there is to it. So if you want to stop an animation or effect is already in play, you can use the stop method, just go select the element or elements, and then you call the start method.

So the advantage of something like this is maybe you have a piece of code that gets triggered that starts in effect. And then you have another piece of code that when it gets triggered, it starts another effect. But you could you could have sort of conflicting, conflicting visuals, you might not look very good. So you stop all existing effects, then you stop the current effect. So that's it for the stop method for effects animation. If you have any questions, feel free to call me a message.

And as usual, I look forward to seeing you in the next video.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.