Closed jenstornell closed 7 years ago
I needed to be able to toggle when clicking on the same tab twice. I made a solution for it. In case someone needs the same thing, here it is:
document.addEventListener("DOMContentLoaded", function(event) { var tabby_active; tabby.init({ callback: function ( tabs, toggle ) { var active_pane = document.querySelector('.tabs-pane.active'); var active_tab = document.querySelector('.tabs .active'); if( tabby_active == toggle ) { active_pane.classList.remove('active'); active_tab.classList.remove('active'); active_tab.querySelector('.active').classList.remove('active'); tabby_active = ''; } else { tabby_active = '#' + active_pane.getAttribute('id'); } } }); });
I needed to be able to toggle when clicking on the same tab twice. I made a solution for it. In case someone needs the same thing, here it is: