I am trying to automatically cycle through my tab content for a charts presentation
I have chosen to use something like this:
Although my version of Jquery 3.3.1 and bootstrap 4.1.3 only allows it to auto cycle to just the next tab and then stops
- var tabChange = function(){
- var tabs = $('.nav-tabs > li');
- var active = tabs.filter('.active');
- var next = active.next('li').length? active.next('li').find('a') : tabs.filter(':first-child').find('a');
- // Bootsrap tab show, para ativar a tab
- next.tab('show')
- }
- // Tab Cycle function
- var tabCycle = setInterval(tabChange, 1000)
- // Tab click event handler
- $(function(){
- $('.nav-tabs a').click(function(e) {
- e.preventDefault();
- // Parar o loop
- clearInterval(tabCycle);
- // mosta o tab clicado, default bootstrap
- $(this).tab('show')
- // Inicia o ciclo outra vez
- setTimeout(function(){
- tabCycle = setInterval(tabChange, 1000)//quando recomeça assume este timing
- }, 1000);
- });
- });
Please help?!
Thanks