0

I tried to reload my html page (having some animation with setinterval) but it is not working perfectly.

document.write(document.documentElement.outerHTML); document.close(); i used this👆but after it reloads , it is increasing my animation speed.....how can i fix it??I am a newbie so please help......🙏

23rd Jul 2017, 12:50 PM
The Codebreaker
The Codebreaker - avatar
12 Réponses
23rd Jul 2017, 3:55 PM
The Coding Sloth
The Coding Sloth - avatar
+ 5
code?
23rd Jul 2017, 2:37 PM
The Coding Sloth
The Coding Sloth - avatar
+ 4
Try clearing the interval using clearInterval(interval) where interval is the variable name for your interval
23rd Jul 2017, 2:08 PM
The Coding Sloth
The Coding Sloth - avatar
+ 4
clearInterval(interval); interval = setInterval(draw, 16); ?
23rd Jul 2017, 2:46 PM
The Coding Sloth
The Coding Sloth - avatar
+ 2
its not working bro.....its still getting faster each time i reload😢
23rd Jul 2017, 2:36 PM
The Codebreaker
The Codebreaker - avatar
+ 2
there is a function "draw()" which i run with setInterval(draw,16);
23rd Jul 2017, 2:39 PM
The Codebreaker
The Codebreaker - avatar
+ 2
its not working.i have made the code public named "backup".check pleasee.......thank u in advance
23rd Jul 2017, 2:52 PM
The Codebreaker
The Codebreaker - avatar
+ 2
it wud be okay if anyone can tell any alternate method to reload the page.
23rd Jul 2017, 3:02 PM
The Codebreaker
The Codebreaker - avatar
+ 2
when i add clearInterval(interval); in my code.it doesnt work
23rd Jul 2017, 4:02 PM
The Codebreaker
The Codebreaker - avatar
+ 2
how??can u explain? or u fixed something else too?
23rd Jul 2017, 4:02 PM
The Codebreaker
The Codebreaker - avatar
+ 2
in my code when i add that line , it says interval isn't defined
23rd Jul 2017, 4:08 PM
The Codebreaker
The Codebreaker - avatar
+ 2
ohh i got it.....thanks a lot mr. the coding sloth..
23rd Jul 2017, 4:13 PM
The Codebreaker
The Codebreaker - avatar