Hi Everyone,
I’m trying to add autoplay to tabs using the following code and all I want to do is stop the autoplay if the user clicks a tab. Does anyone know what I would need to change/add? My JS skills leave a lot to be desired.
Thanks in advance!!
// start everything
var tabTimeout;
clearTimeout(tabTimeout);
tabLoop();
// Cycle through all tabs. Match class names
function tabLoop() {
tabTimeout = setTimeout(function() {
var $next = $('.rounded-tabs').children('.w--current:first').next();
if($next.length) {
$next.click(); // user click resets timeout
} else {
$('.standard-tabs:first').click();
}
}, 6000); // 6 second tab loop (change this)
}
// Reset loop if a tab is clicked
$('.standard-tabs').click(function() {
clearTimeout(tabTimeout);
tabLoop();
});
});
</script>````