KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Normally, I’d set the interval to a variable and then clear it like var the_int = setInterval(); clearInterval(the_int); but for my code to work I put it in an anonymous function: function intervalTrigger() { setInterval(function() { if (timedCount >= markers.length) { timedCount = 0; } google.maps.event.trigger(markers[timedCount], "click"); timedCount++; }, 5000); }; intervalTrigger(); How do I clear this? I gave it a shot and tried var test = intervalTrigger(); clearInterval(test); to be sure, but that didn’t work. Basically, I need this to stop triggering once my Google Map is clicked, e.g. google.maps.event.addListener(map, "click", function() { //stop timer });
Tags (comma-separated)
Save Edits
Cancel