From 4affa4001afa5cad8ed2e8cd865fae21812badce Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 26 Feb 2016 00:35:57 +0000 Subject: View job contents --- webgui/data/tabs.js | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'webgui/data/tabs.js') 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 @@ jQuery(document).ready(function() { - jQuery('.tabs .tab-links a').on('click', function(e) { - var currentAttrValue = jQuery(this).attr('href'); + 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(); + // Show/Hide Tabs + jQuery('.tabs ' + currentAttrValue).show().siblings().hide(); - // Change/remove current tab to active - jQuery(this).parent('li').addClass('active').siblings().removeClass('active'); + // Change/remove current tab to active + jQuery(this).parent('li').addClass('active').siblings().removeClass('active'); - e.preventDefault(); - }); -}); + e.preventDefault(); +} -- cgit v1.2.3