diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-02-26 00:35:57 +0000 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-02-26 00:35:57 +0000 |
commit | 4affa4001afa5cad8ed2e8cd865fae21812badce (patch) | |
tree | 6aad35eb4b8f70451e35c6030b881c77ffbcb5cb /webgui/data/tabs.js | |
parent | 8640e03551a8da768291c4b02eb5eae8742e3b45 (diff) | |
download | thermoprint-4affa4001afa5cad8ed2e8cd865fae21812badce.tar thermoprint-4affa4001afa5cad8ed2e8cd865fae21812badce.tar.gz thermoprint-4affa4001afa5cad8ed2e8cd865fae21812badce.tar.bz2 thermoprint-4affa4001afa5cad8ed2e8cd865fae21812badce.tar.xz thermoprint-4affa4001afa5cad8ed2e8cd865fae21812badce.zip |
View job contents
Diffstat (limited to 'webgui/data/tabs.js')
-rw-r--r-- | webgui/data/tabs.js | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/webgui/data/tabs.js b/webgui/data/tabs.js index 1d178d9..0cdb8e5 100644 --- a/webgui/data/tabs.js +++ b/webgui/data/tabs.js | |||
@@ -1,13 +1,22 @@ | |||
1 | jQuery(document).ready(function() { | 1 | jQuery(document).ready(function() { |
2 | jQuery('.tabs .tab-links a').on('click', function(e) { | 2 | jQuery('.tabs .tabLinks a').on('click', switchTab); |
3 | var currentAttrValue = jQuery(this).attr('href'); | 3 | |
4 | var observer = new window.MutationObserver(function(mutations, observer) { | ||
5 | jQuery('.tabs .tabLinks a').on('click', switchTab); | ||
6 | }); | ||
7 | jQuery('.tabLinks').each( function () { | ||
8 | observer.observe(this, { childList: true, subtree: true }); | ||
9 | }); | ||
10 | }); | ||
11 | |||
12 | function switchTab(e) { | ||
13 | var currentAttrValue = jQuery(this).attr('href'); | ||
4 | 14 | ||
5 | // Show/Hide Tabs | 15 | // Show/Hide Tabs |
6 | jQuery('.tabs ' + currentAttrValue).show().siblings().hide(); | 16 | jQuery('.tabs ' + currentAttrValue).show().siblings().hide(); |
7 | 17 | ||
8 | // Change/remove current tab to active | 18 | // Change/remove current tab to active |
9 | jQuery(this).parent('li').addClass('active').siblings().removeClass('active'); | 19 | jQuery(this).parent('li').addClass('active').siblings().removeClass('active'); |
10 | 20 | ||
11 | e.preventDefault(); | 21 | e.preventDefault(); |
12 | }); | 22 | } |
13 | }); | ||