HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
This tutorial will show you how to create an autoplay Tabs. Tabs component displays the first tab panel, then display the second, third /en. we will write some code to automatically switch tab panels, then let it cycle.
<Div id = "tt" class = "easyui-tabs" style = "width: 330px; height: 270px;"> <Div title = "Shirt1" style = "padding: 20px;"> <Img src = "images / shirt1.gif"> </ Div> <Div title = "Shirt2" style = "padding: 20px;"> <Img src = "images / shirt2.gif"> </ Div> <Div title = "Shirt3" style = "padding: 20px;"> <Img src = "images / shirt3.gif"> </ Div> <Div title = "Shirt4" style = "padding: 20px;"> <Img src = "images / shirt4.gif"> </ Div> <Div title = "Shirt5" style = "padding: 20px;"> <Img src = "images / shirt5.gif"> </ Div> </ Div>
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' approach to get all the tab panels, and use the 'setInterval' function to switch them.