Joeytje50 has uploaded a new change for review. https://gerrit.wikimedia.org/r/184202
Change subject: Fix scrolling in Chrome, add scroll documentation ...................................................................... Fix scrolling in Chrome, add scroll documentation Scrolling/hotlinking tabs didn't work in Chrome; fixed that also added documentation about the hotlinking of tabs to README. Change-Id: I21018afe9351a073f04f99477ed49f7f13fc32d0 --- M README.md M Tabs.php M ext.tabs.js 3 files changed, 8 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Tabs refs/changes/02/184202/1 diff --git a/README.md b/README.md index d895546..b188a4a 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,10 @@ |style=color:{{#if:{{{1|}}}|green|red}} }} </pre> +==== Hotlinking tabs ==== + +It is possible to hotlink tabs the same way as hotlinking sections on pages. Simply put the tab label in the URL, and the page will automatically scroll to the top of the tab, and open the selected tab. This will always open only the very first tab that has the specified tab label (for example, if there are two tab boxes that both have a tab labelled "Tab 1", putting <code>#Tab_1</code> in the URL will scroll to the first one on the page). If there is already another element on the page that could be scrolled to, such as a page section, that other element will have priority, and the tab will not be focused. + === Toggle box === ==== Documentation ==== @@ -365,7 +369,7 @@ If you want to place a toggle box or dropdown menu inside a tab menu, you can simply place a <code><tab></code> tag inside the <code><tab></code> tag that functions as a tab. This will restrict toggle boxes and dropdowns to visibility in just one tab though. So, if you want to have a toggle box or dropdown that's visible in every tab, encase it in a <code><tab></code> tag with an <code>index="*"</code> set to it. -That way, the outer <code><tab></code> tag will be recognised as a tab container, and the inner one will be recognised as a toggle box or dropdown menu, as desired. The toggle box or dropdown must then also use the [[#General usage information|parser function syntax]]. +That way, the outer <code><tab></code> tag will be recognised as a tab container, and the inner one will be recognised as a toggle box or dropdown menu, as desired. The toggle box or dropdown must then also use the [[#Nested combinations|parser function syntax]]. If you want the contents of the toggle box inside the tab menu to be able to change depending on the selected tab, you should use the <code>nested="true"</code> attribute on the tag. This can be done by setting the very last argument of the <code>#tab:</code> parser function or the <code>#tag:tab</code> parser function to <code>nested=true</code>. diff --git a/Tabs.php b/Tabs.php index f33b2fe..50cc9de 100644 --- a/Tabs.php +++ b/Tabs.php @@ -30,7 +30,7 @@ 'author' => 'Joeytje50', 'url' => 'https://www.mediawiki.org/wiki/Extension:Tabs', 'descriptionmsg' => 'tabs-desc', - 'version' => 1.3, + 'version' => '1.3.1', 'license-name' => 'GPLv2+' ); diff --git a/ext.tabs.js b/ext.tabs.js index 3e71a30..1c56b57 100644 --- a/ext.tabs.js +++ b/ext.tabs.js @@ -16,7 +16,7 @@ return true; // continue the $.each() function } this.click(); // open the selected tab by default. - document.documentElement.scrollTop = this.offsetTop; + window.scrollTo(0, $(this).offset().top); return false; // stop the $.each() function after the first match. }); } @@ -48,6 +48,7 @@ } else { $(moveToHash); } + addEventListener('hashchange', moveToHash); /* * System to fix toggle boxes in Android Browser -- To view, visit https://gerrit.wikimedia.org/r/184202 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I21018afe9351a073f04f99477ed49f7f13fc32d0 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Tabs Gerrit-Branch: master Gerrit-Owner: Joeytje50 <joeytj...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits