From 23817c7775679cb303ec3bbe595668714bbc888a Mon Sep 17 00:00:00 2001 From: Jim Phillips Date: Thu, 19 Nov 2015 20:19:31 -0500 Subject: [PATCH] fix links for updated design Change-Id: I64421748ed2a7d21ed63f7eeaac66b6311f22659 --- _templates/mirantis/static/abtest.js | 14 -------------- .../mirantis/static/bootstrap-sphinx.js_t | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/_templates/mirantis/static/abtest.js b/_templates/mirantis/static/abtest.js index ac0d6b2ce..1e8b71f47 100644 --- a/_templates/mirantis/static/abtest.js +++ b/_templates/mirantis/static/abtest.js @@ -8,20 +8,6 @@ jQuery.ajax({ dataType: "script" }); -$(window).hashchange(function(){ showHashTab(); }); - -function showHashTab(){ - console.log('showHashTab'); - if(location.hash){ - var activeTab = $('[href=' + location.hash + ']'); - if (activeTab.length) { - activeTab.tab('show'); - } else { - $('.nav-tabs a:first').tab('show'); - } - } -} - function getParameterByName(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), diff --git a/_templates/mirantis/static/bootstrap-sphinx.js_t b/_templates/mirantis/static/bootstrap-sphinx.js_t index 1eb532ec5..b2491f834 100644 --- a/_templates/mirantis/static/bootstrap-sphinx.js_t +++ b/_templates/mirantis/static/bootstrap-sphinx.js_t @@ -210,7 +210,24 @@ nav(); - $(window).hashchange(function(){ nav(); }); + showHashTab(); + + $(window).hashchange(function(){ nav(); showHashTab();}); + + function showHashTab(){ + console.log('showHashTab'); + if(location.hash){ + var activeTab = $('#nav-spy').find('[href=' + location.hash + ']'); + if (activeTab.length) { + activeTab.tab('show'); + } else { + //$('.nav-tabs a:first').tab('show'); + console.log('no length'); + var parentTab = $(location.hash).closest('.section.tab-pane'); + $('#nav-spy').find('[href=#' + $(parentTab).attr('id') + ']').tab('show'); + } + } + } // list-group-accordion functionality var listAccordion = $('.list-group-accordion');