Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
How can i do for add ".active" class to anchor link (linke: /#same) on my menu links?
Comments
Comment #2
markhalliwellThey should already have the necessary classes, but a simple google search could answer your question if it's not to your liking.
Comment #3
Idas CreditAttribution: Idas commentedSorry but doesn't it feel that way. By default Bootstrap theme add .active class only on a link it's same of url page.
For example, in a one page site, all of the link in navbar have the class ".active"
Sure, I know how to make it work with a custom javascript.
Comment #4
Idas CreditAttribution: Idas commentedOk, redefine.
When we use the "scrollspy" this don't work because drupal writes the menu link with slash "/".
For example:
/#example
This is because we need to put first of hashtag anchor.
A quick solution is to work with Void Menu module. But you have 10 item limit.