I have a Carousel which uses the setInterval() to toggle between the tabs every 4 seconds. I now want to stop this auto-toggle on click of any particular tab.
The clearInterval() is getting called only after a cycle, and not immdetiately when a tab is selected.
Please point me to what is wrong in my function call.
jsfiddle.net/qjmDU/14 is the JS fiddle where I have my html and jquery. I am guessing that the problem is the following code being used in the wrong place.
$(this).on("click", function (event) {
console.log("After clear interval" + stopVar);
clearInterval(stopVar);
});