active-class on nav-item not working
See original GitHub issueHello.
We have updated to latest BootstrapVue
version (rc13
) and noticed, that active-class
for b-nav-item
stopped working.
This is also reproducible on documentation pages and https://jsfiddle.net/n4ekygf8/.
I checked with Firefox
(65.0.2
) and Chrome
(72.0.3626.119
).
I am not a Vue
or bootstrap
expert, but before it worked as expected 😃
Best, Zakhar
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Bootstrap navbar Active State not working - Stack Overflow
I use the class="active" on my navbar and it does not switch when I press menu items. I know how to do this...
Read more >Active state not working in Bootstrap menu
Solved: Hi, I am trying to set up a simple Bootstrap menu it works fine except the Active component doesn't work.
Read more >How to set active class to nav menu from bootstrap
To set the active class to the navigation menu dynamically by scrolling or clicking on the navigation links, the active class is to...
Read more >How To Add Active Class To Current Element - W3Schools
Learn how to add an active class to the current element with JavaScript. Highlight the active/current (pressed) button: 1 2 3 4 5....
Read more >Bootstrap Navbar Change Active Class Link - CodePen
Insecure Resource. The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Also note, the
active-class
is only applied if you are usingvue-router
and there is ato
prop on the component (the docs are running under Nuxt, which uses vue-router under the hood).Vue-router (not BootstrapVue) applies the active class when the to prop path/location matches the current route/page url.
See updated fiddle: https://jsfiddle.net/ozu2ny58/
The reason it was working before was that you were taking advantage of a bug in
<b-nav-item>
in how the vue-routeractive-class
prop was being used/applied.