From 33bd730576de2b779af424a98ac27f2cdf4676aa Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Sun, 29 Mar 2015 21:44:05 +0200 Subject: [PATCH] refactor tabs --- lib/tabs.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/tabs.js b/lib/tabs.js index 17f80c7..89c348b 100644 --- a/lib/tabs.js +++ b/lib/tabs.js @@ -7,15 +7,19 @@ define([], function () { var container = document.createElement("div") - function switchTab() { + function gotoTab(li) { for (var i = 0; i < tabs.children.length; i++) { var el = tabs.children[i] el.classList.remove("visible") el.tab.classList.remove("visible") } - this.classList.add("visible") - this.tab.classList.add("visible") + li.classList.add("visible") + li.tab.classList.add("visible") + } + + function switchTab() { + gotoTab(this) return false }