Topic: How to make a navbar dropdown-link active automatically?
I wanna make dropdown-link active when any of its items is on. Same as in sidenav-link with collapsible content.
cloudsyte2 pro premium answered 3 years ago
This might help https://stackoverflow.com/questions/42941245/navbar-css-automatic-add-active-in-dropdown-menu
Change the code according to your framework (js/react).
Also, what you need to do in a nutshell is, watch for the URL (window.location) and see if it is equal to your dropdown link route.
Dawid Wajszczuk staff answered 3 years ago
Hi,
What @cloudsyte2 sent will get the job done. Here is the snippet with possible solution for MDB https://mdbootstrap.com/snippets/standard/d-wajszczuk/3768473.
Keep coding,
Dawid
Bellmare answered 2 years ago
If you want your navbar dropdown-link to be active automatically, you can use the "active" class.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Free
- Premium support: No
- Technology: MDB Standard
- MDB Version: MDB5 3.11.0
- Device: Any
- Browser: Any
- OS: Any
- Provided sample code: No
- Provided link: No