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:
@@ -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();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user