[Support request] Problems with anchor links

Home Forums Support [Support request] Problems with anchor links

Home Forums Support Problems with anchor links

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #912275
    David Westerlund

    I’m trying to link my sub menu items to sections further down on the page. But the behavior is not fully as I want it to be. There is basically two problems:

    1. I want the first menu item to be highlighted when I enter the page, since that’s the top section, “Vi som jobbar här”. But I can’t get it to be highlighted. It works if I choose just “/kontakt/” as path for the menu item. But then the highlight won’t go away when I scroll down the page to other sections. Maybe the highlight would work if I set an ID to the body-element of the page. Or how is this supposed to work? I wanna know if there is an idea behind this? How it supposed to work.

    2. When clicking a sub menu item, the page scrolls down very nice and smoothly. But it stops at a point where the title for that specific section gets hidden behind the sticky navigation. What is the idea here? Is there any setting I missed to tell the scrolling that I’m using a sticky navigation?

    #912369
    Leo
    Staff
    Customer Support

    Hi there,

    1. Hmm I don’t think it’s possible to highlight the menu item “Vi som jobbar här” when you enter that page as there is no relationship between that menu item and the page.

    The item “Kontakt” is highlighted because it’s on that page.

    As you already discovered, the only way to highlight that menu item is to use the same link as Kontakt.

    2. Are you using GP’s smooth scroll? It should take the sticky navigation height into consideration:
    https://docs.generatepress.com/article/smooth-scroll/

    Let me know 🙂

    #912404
    David Westerlund

    About problem 1, no, but if I set #vi-som-jobbar-har to the menu item and if the body tag would have that ID. Wouldn’t that work?

    About problem nr 2. Okay, I have enabled the smooth scroll now from general settings. I have also added the smooth-scroll class to the “Skriv till oss” menu item for testing. And it seems to first scroll to the right position, just to change the position right after. What’s wrong?

    #912408
    Leo
    Staff
    Customer Support

    1. Hmm I’m not sure but you can definitely give it a shot. GP just uses the default WordPress menu system and doesn’t interfere with how it works.

    2. Looks like some sort of conflict. Did you disable the previous smooth scroll script?

    #912425
    David Westerlund

    I haven’t enabled any other smooth scroll, at least not on purpose. We don’t even have that many plugins installed. Elementor doesn’t have any smooth scroll right?

    #912428
    Leo
    Staff
    Customer Support

    Hmm there was smooth scroll originally before I asked you to use GP’s smooth scroll so it must be coming from somewhere.

    I don’t know if Elementor has smooth scroll or not.

    #912487
    David Westerlund

    Okay so apparently Elementor has a built in smooth scrolling that is not possible to just disable. But there is a walkaround where I could just add a HTML-widget with a anchorlink as target. So it works now. It’s GeneratePress’s smoothscroll. But now the highlighting isn’t working. So that’s not a feature that GeneratePress has? That the menu items are highlighted for when the menu item’s anchor matches the #id in the web address?

    #912495
    Leo
    Staff
    Customer Support
    #912498
    David Westerlund

    Aha, a totally other scroll plugin. But then I will lose the GenerarePress smooth-scroll feature that is aware of the sticky header…?

    #912526
    Leo
    Staff
    Customer Support

    Should still work.

    Give it a shot and let us know if you encounter issues again 🙂

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.