jQuery EasyUI Layout - Adding Auto-Play Tabs
This tutorial will show you how to create auto-playing Tabs. The Tabs component displays the first tab panel, then the second, the third, and so on. We will write some code to switch tab panels automatically and then make it loop.
Step 1: Create Tabs
Step 2: Write the auto-play code
var index = 0;
var t = $('#tt');
var tabs = t.tabs('tabs');
setInterval(function(){
t.tabs('select', tabs[index].panel('options').title);
index++;
if (index >= tabs.length){
index = 0;
}
}, 3000);
As you can see, we call the 'tabs' method to get all tab panels and use the 'setInterval' function to switch them.