+ 3

Why is my stop animation button not working and why is there a uncaught range error on console.

https://code.sololearn.com/WUiKBLMhtnej/?ref=app

1st May 2021, 8:21 AM
mustafa raza
mustafa raza - avatar
4 odpowiedzi
+ 2
In line 27 in function repeat() you are calling function repeat() which leads to infinite recursion which in turn causes the maximum call stack size to be exceeded. (In short your program tries to run repeat() infinitely many times)
1st May 2021, 8:41 AM
Hape
Hape - avatar
+ 1
Hape thank you it worked , but what if i want to repeat that animation infinite times , how do we do that
1st May 2021, 9:16 AM
mustafa raza
mustafa raza - avatar
+ 1
mustafa raza I am not an expert with jQuery but according to the documentation of the animate method we can supply a callback function which gets called when the animation is completed. We can use this like so: https://code.sololearn.com/WA15a24A0a19/?ref=app
1st May 2021, 10:08 AM
Hape
Hape - avatar
+ 1
Hape thank you bro , you are an expert , just accept it 😀.
1st May 2021, 10:14 AM
mustafa raza
mustafa raza - avatar