Skip to content
Snippets Groups Projects
Commit 3aeccdc0 authored by Demian Katz's avatar Demian Katz
Browse files

Smarter tab behavior for noajax tabs.

parent 6f0e5434
Branches
Tags
No related merge requests found
......@@ -229,12 +229,25 @@ function recordDocReady() {
$('.record-tabs .nav-tabs a').click(function (e) {
var $li = $(this).parent();
// If it's an active tab, click again to follow to a shareable link.
// if we're flagged to skip AJAX for this tab, just return true and let the browser handle it.
if($li.hasClass('active') || $li.hasClass('noajax')) {
if ($li.hasClass('active')) {
return true;
}
var tabid = this.className;
var $top = $(this).closest('.record-tabs');
// if we're flagged to skip AJAX for this tab, we need special behavior:
if ($li.hasClass('noajax')) {
// if this was the initially active tab, we have moved away from it and
// now need to return -- just switch it back on.
if ($li.hasClass('initiallyActive')) {
$(this).tab('show');
$top.find('.tab-pane.active').removeClass('active');
$top.find('.'+tabid+'-tab').addClass('active');
window.location.hash = 'tabnav';
return false;
}
// otherwise, we need to let the browser follow the link:
return true;
}
$top.find('.tab-pane.active').removeClass('active');
$(this).tab('show');
if ($top.find('.'+tabid+'-tab').length > 0) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment