tabs: do not open tabs by default
This commit is contained in:
parent
27752b2270
commit
3eabb5f351
16
lib/tabs.js
16
lib/tabs.js
|
@ -8,12 +8,17 @@ define([], function () {
|
|||
var container = document.createElement("div")
|
||||
|
||||
function gotoTab(li) {
|
||||
var visible = li.classList.contains("visible")
|
||||
|
||||
for (var i = 0; i < tabs.children.length; i++)
|
||||
tabs.children[i].classList.remove("visible")
|
||||
|
||||
while (container.firstChild)
|
||||
container.removeChild(container.firstChild)
|
||||
|
||||
if (visible)
|
||||
return
|
||||
|
||||
li.classList.add("visible")
|
||||
|
||||
var tab = document.createElement("div")
|
||||
|
@ -34,17 +39,6 @@ define([], function () {
|
|||
li.onclick = switchTab
|
||||
li.child = d
|
||||
tabs.appendChild(li)
|
||||
|
||||
var anyVisible = false
|
||||
|
||||
for (var i = 0; i < tabs.children.length; i++)
|
||||
if (tabs.children[i].classList.contains("visible")) {
|
||||
anyVisible = true
|
||||
break
|
||||
}
|
||||
|
||||
if (!anyVisible)
|
||||
gotoTab(li)
|
||||
}
|
||||
|
||||
self.render = function (el) {
|
||||
|
|
Loading…
Reference in a new issue