javascript - problem with setInterval(); and clearInterval -
I have a problem with the Setinterval, it's probably best to show an example, here's a link:
Actually, I'm having trouble doing this work as if I need it when the page loads, the content rotates every three seconds and the buttons on the right also do this. When you click on a button the buttons increase and the animation stops - all the good. Then when you click the small closed button under the button that starts the animation - all good .... But then when you click the number button, the animation continues again. Why?
There are so many codes, but there are set intervals and clear intervals:
- Line 69: On the document. Already the animation starts off - a global variable
- line 87: the user clicks the numbered button in that animation on an empty time
- line 102: when the user clicks on the closure button So the animation starts again
That's it ... I do not get why he does not stop the animation a second time ... Why can anyone see?
Any thoughts?
$ Close button. () {...}); The handler that is inside your loop is being added 4 times, so when you click on the close, 4 timers are added and when the menu opens again only 1 gets cleared.
Comments
Post a Comment