From 093f99a794e0ff6107fbd052560b0ecfb5ca623e Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 24 Jul 2010 16:56:31 +0000 Subject: - Patch #376293 by casey, Dave Reid, droidenator, moshe weitzman: activate current vertical tab from URL fragment. --- misc/vertical-tabs.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'misc') 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(); -- cgit v1.2.3