aboutsummaryrefslogtreecommitdiff
path: root/webgui/data/tabs.js
blob: 0cdb8e5dbfea6e86653776cfa2ae3c15fa4c8cba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
jQuery(document).ready(function() {
    jQuery('.tabs .tabLinks a').on('click', switchTab);

    var observer = new window.MutationObserver(function(mutations, observer) {
	jQuery('.tabs .tabLinks a').on('click', switchTab);
    });
    jQuery('.tabLinks').each( function () {
	observer.observe(this, { childList: true, subtree: true });
    });
});

function switchTab(e) {
    var currentAttrValue = jQuery(this).attr('href');
 
    // Show/Hide Tabs
    jQuery('.tabs ' + currentAttrValue).show().siblings().hide();
 
    // Change/remove current tab to active
    jQuery(this).parent('li').addClass('active').siblings().removeClass('active');
 
    e.preventDefault();
}