The GK restart method can be used to stop an animation before it's finished.
The stop method works for all animation types including sliding fading and custom animations here's
an example of the stop method we can start the animation by clicking the start button.
We can stop the animation at any point by pressing the stop on.
Now let's take a look at the script.
First we can see that all our elements are in the body tag the Start Button has the ideas start the
stop button has the IP stop the square itself as the ideas square
our style sheet simply defines the look of the square so we can see it has a blue background within
height of 160 pixels 5 pixel margin from the top and the position of absolute and we've been over this
in a previous exercise as well so let's go right to this script in the script we can see that first
we've attached a click event to the start button once to start button is clicked the square div element
animates it moves eight hundred pixels from the left position at a speed of three hundred milliseconds
next we've attached a click event to the stop button when the stop button is quick the square animation
is set to stop and that's using the stop method.