Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery(function() {
- //cache a reference to the tabs
- var tabs = jQuery('.responsive-tabs__list li');
- //on click to tab, turn it on, and turn previously-on tab off
- tabs.click(function() { jQuery(this).addClass('responsive-tabs__list__item--active').siblings('.responsive-tabs__list__item--active').removeClass('responsive-tabs__list__item--active'); });
- //auto-rotate
- setInterval(function() {
- //get currently-on tab
- var onTab = tabs.filter('.responsive-tabs__list__item--active');
- //click either next tab, if exists, else first one
- var nextTab = onTab.index() < tabs.length-1 ? onTab.next() : tabs.first();
- nextTab.click();
- }, 8000);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement