diff options
Diffstat (limited to 'misc/vertical-tabs.js')
-rw-r--r-- | misc/vertical-tabs.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/misc/vertical-tabs.js b/misc/vertical-tabs.js index fb4b91a6f..0c66ec6c1 100644 --- a/misc/vertical-tabs.js +++ b/misc/vertical-tabs.js @@ -49,7 +49,14 @@ Drupal.behaviors.verticalTabs = { $('> li:last', tab_list).addClass('last'); if (!tab_focus) { - tab_focus = $('> .vertical-tabs-pane:first', this); + // If the current URL has a fragment and one of the tabs contains an + // element that matches the URL fragment, activate that tab. + if (window.location.hash && $(window.location.hash, this).length) { + tab_focus = $(window.location.hash, this).closest('.vertical-tabs-pane'); + } + else { + tab_focus = $('> .vertical-tabs-pane:first', this); + } } if (tab_focus.length) { tab_focus.data('verticalTab').focus(); |