Highlight active current section

  • fireant456

    #10451

    I have made a page with many sections and would like the nav bar to update to apply the active class to the section that is currently being viewed. Each section has it’s own custom link that points to that section in the navbar. But istead of changing to the active color when that section have been selected they are all blue because they are all on the same page.

    Any suggestions on how to get this working how I want it?

    Thanks!

    Admin

    Syahir Hakim

    #46170

    This is beyond the scope of this support forum, but generally you would need to write custom javascript codes that achieve something like this:

    1. Remove .current-menu.item class from the active menu.
    2. Detect the current scroll position of the page.
    3. Add the .current-menu-item class to the menu item that corresponds to the anchor at the current scroll position of the page.

Viewing 2 posts - 1 through 2 (of 2 total)

  • You must be logged in to reply to this topic.