stop toggle | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

stop toggle

hi everybody, i have a toggle fucntion that show a div and hide another, after 5 seconds the div hidden is showen and the other is hidden. i want to stop the toggle function after a click inside the div and when i click a double click the toggle must play again. this is how a create the toggle: var intervalID = setInterval(function() { $("#mydiv2").toggle(); $("#mydiv1").toggle(); }, 5000); setTimeout(function() { clearInterval(intervalID); }, 30000);

4th Feb 2019, 8:58 AM
ABDELMOUGHIT GARDAM
ABDELMOUGHIT GARDAM  - avatar
2 Answers
+ 2
And? Now write onclick func.
7th Feb 2019, 11:45 AM
lemuriec
lemuriec - avatar
0
@lemuriec i used a sleep function but now i want to show a message without alert if a condition is realised.
8th Feb 2019, 8:53 AM
ABDELMOUGHIT GARDAM
ABDELMOUGHIT GARDAM  - avatar