1
0
mirror of https://github.com/tabler/tabler.git synced 2026-07-21 04:52:21 +04:00

Merge pull request #768 from kilab-dev/open-tabs-from-url

Open specific tab from hyperlink
This commit is contained in:
Michał Wolny
2021-05-03 21:37:28 +02:00
committed by GitHub
2 changed files with 16 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
import { Tab } from 'bootstrap';
export const EnableActivationTabsFromLocationHash = () => {
const locationHash = window.location.hash;
if (locationHash) {
const tabsList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tab"]'));
const matchedTabs = tabsList.filter(tab => tab.hash === locationHash);
matchedTabs.map(tab => {
new Tab(tab).show();
});
}
}
+2
View File
@@ -6,5 +6,7 @@ import './src/dropdown';
import './src/tooltip';
import './src/popover';
import './src/switch-icon';
import { EnableActivationTabsFromLocationHash } from './src/tab';
import './src/toast';
EnableActivationTabsFromLocationHash();