Skip to content
Snippets Groups Projects
Commit 15a9b08b authored by Stefan Galinski's avatar Stefan Galinski :video_game:
Browse files

[BUGFIX] Fix tab navigation (MAJOR BUG)

parent 64bed317
No related branches found
Tags 3.2.4
No related merge requests found
......@@ -29,6 +29,11 @@ SG.TabListener = function() {
};
SG.TabListener.prototype = {
/**
* @var {int|null} intervalCall
*/
intervalCall: null,
/**
* Jumps to the best tab if a tab hash is set
*
......@@ -36,14 +41,26 @@ SG.TabListener.prototype = {
*/
initialize: function() {
this.checkAndSwitchActiveTab();
setInterval(this.checkAndSwitchActiveTab, 1000);
this.intervalCall = setInterval(this.checkAndSwitchActiveTab, 600);
$('[data-toggle="tab"]').click(this.handleTabClick);
},
/**
* Checks the segment of the url and activates another tab if requested
*/
checkAndSwitchActiveTab: function() {
var $tabLink = $('a[href="' + location.hash + '"]');
var $tabLink = $('a[href$="' + location.hash + '"]');
if ($tabLink.length && $tabLink.tab) {
$tabLink.tab('show');
}
},
/**
* Changes the url on tab click
*/
handleTabClick: function() {
var tab = $(this);
location.href = tab.attr('href');
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment