Site logo

[Resolved] Anchor links not working on mobile

Home Forums Support [Resolved] Anchor links not working on mobile

Home Forums Support Anchor links not working on mobile

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #2443258
    Justin

    I have a single page site that I built for a client using anchor links in the navigation. On desktop they work correctly. However, when I click a navigation item on mobile, it briefly displays the section of the page its supposed to, then jumps back to the top of the page and closes out the off canvas panel.

    I’ve disabled my caching plugin and ensured that both the Generatepress theme and GP Premium are up to date.

    The website in question is https://fisherconstructionandexcavation.com/

    Thanks in advance!

    #2443380
    Leo
    Staff
    Customer Support

    Hi Justin,

    Can you try using the full URL instead of just the #anchor for the link?

    Let me know 🙂

    #2443436
    Justin

    Hey Leo, thanks for your quick response.

    I tired changing the link to the full URL as suggested and it didn’t work. Anything else I can try?

    This is an image of the full url being entered.

    #2443447
    Leo
    Staff
    Customer Support

    Very strange.

    Can you disable all plugins except GP Premium and GenerateBlocks to test?

    Make sure any custom functions are disabled as well.

    Thought I should also mention that we have a built-in smooth scroll script that might be worth considering for a one page site:
    https://docs.generatepress.com/article/smooth-scroll/

    Let me know 🙂

    #2443453
    Justin

    I tried disabling all plugins except those two and still no difference. I also tried enabling and disabling the smooth scroll function you mentioned and that didn’t do anything either.

    #2443486
    Ying
    Staff
    Customer Support

    Hi Justin,

    Anchor links usually don’t work with off canvas menu.

    Can you try this solution?
    https://generatepress.com/forums/topic/off-canvas-panel-working-with-anchor-links/#post-1561238

    #2444678
    Justin

    Ok, so after investigating the issue further I want to make mention of the following:

    I have three sites that are all using a one page layout with anchor links in the navigation. They are…

    https://fisherconstructionandexcavation.com/
    https://chpartypinatas.com/
    https://demo1.childressdesigns.com/

    The first two have the most up to date version of Generatepress and GP Premium installed and both of them are experiencing the same issue with the anchor links not working in the off-canvas mobile menu. This didn’t occur until recently. Both of the sites used to function properly.

    The last one – demo1.childressdesigns.com – has not been updated to the most recent version of GP Premium and the anchor links are working properly.

    That being said, it seems like the issue is with the updated version of GP Premium.

    Thoughts?

    #2446036
    Fernando
    Customer Support

    Hi Justin,

    I see. Do you have Mobile Header enabled for https://demo1.childressdesigns.com/

    If it’s enabled, can you temporarily disable it and check if the issue will exist on an un-updated GP and GPP versions?

    And, can you check if you have it enabled for the other two? If not, enable it. Can you test these as well afterward?

    Let us know how it goes.

    #2446708
    Justin

    Fernando,

    Mobile header was OFF on all three sites.

    I temporarily enabled it on the two sites I’m experiencing issues with (Fisher Construction & Excavation / CHPartyPinatas) and it didn’t change anything. The anchor links still aren’t working.

    #2447483
    Tom
    Lead Developer
    Lead Developer

    Hey Justin,

    Just confirmed that this is a bug in the latest GP Premium.

    For now, you can disable the Off Canvas panel and use the standard mobile menu as the bug doesn’t exist there.

    Will post back here once I have news on an update or a temporary fix.

    Thanks – sorry for the inconvenience!

    #2447500
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Can you try this fix?: https://gist.github.com/tomusborne/9017bfacdbc6c4f4980104062168963d

    1. Download this file as offside.min.js
    2. Upload (and replace) this file to wp-content/plugins/gp-premium/menu-plus/function/js

    Let me know 🙂

    #2448082
    Justin

    Hey Tom,

    That did the trick. Thanks so much!

    #2448597
    Tom
    Lead Developer
    Lead Developer

    Thanks for letting me know! We’ll release a patch with this shortly.

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