Topic: Link to Specific Tab from another page
DWDesign
free
asked 6 years ago
I would like to make a link on my main-nav that will link to the profile tab on this page when it is clicked. I tried <a href="index.html#profile-just">Profile</a> but it still only shows the first tab when it is clicked.
Please let me know if there is a way to directly open a tab from another page.
Jakub Strebeyko
staff
answered 6 years ago
Hi there, @DWDesign ,
Thanks for reaching out! You can control which tab gets displayed by using
$('#profile-just').tab('show')
To have tabs react on a particular url change, I suggest listening to the hashchange event on window:
function hashchanged(){ var hash = location.hash.replace( /^#/, '' ); // Your code to have the proper tabs open, like
// $(#profile-just).tab('show')... } window.addEventListener("hashchange", hashchanged, false);
Hope it helps.
With Best Regards,
Kuba
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Free
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.5.15
- Device: HP Desktop
- Browser: Google Chrome
- OS: Windows 10
- Provided sample code: Yes
- Provided link: No