Celebrating 7 Years! Get up to $30 off GeneratePress Premium!

[Resolved] Smooth scroll breaks full path anchor links with hash

Home Forums Support [Resolved] Smooth scroll breaks full path anchor links with hash

Home Forums Support Smooth scroll breaks full path anchor links with hash

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #579170
    Mike

    It seems the new smooth-scroll class works as intended if the anchor link is the simple a href=”#id”

    But if I use it on a full link like this:

    a herf=”http://www.mysite.com/#id” or a relative root path like /path/#id

    Then clicking the link simply does nothing at all. The link becomes “dead”.

    As you can see, sometimes we do need to use the full path links for things like in the navigation menu, because not all the anchors will be on the same page. If it won’t do smooth scroll when pointed to a different page, it should at least follow the link, so basically smooth if the user is on the same page, and no smooth if on different page.

    Could you please take a look into this?

    Thanks.

    GeneratePress 2.1.2
    GP Premium 1.6.2
    #579290
    Tom
    Lead Developer
    Lead Developer

    That’s strange – I can’t replicate that issue. Can you add the URL to your site within the URL field of your original post?

    #579340
    Mike

    Hello Tom,

    I updated the URL of my development site. The link examples in question:

    “Why Choose Us” on the top menu has just the relative #link, it works.
    “Industries” has full path. It doesn’t work.

    Thanks.

    #579394
    David
    Staff
    Customer Support

    Hi Mike, i think smooth scroll is for use with the GP navigation and not the mega menu, which looking at the markup seems it has its own smooth scroll function (?)

    #579709
    Mike

    The Max Mega Menu doesn’t have its own smooth scroll, it just copies every CSS class of the menu and add a mega- prefix to them. The basic smooth-scroll class still remains.

    I tried non-menu links. For example, links in the body of the page (see the “common issues” link), and it behaves the same. Full path + smooth-scroll = dead link.

    Thanks.

    #579830
    Tom
    Lead Developer
    Lead Developer

    So let’s look at the common issues button. If you remove the / from in front of the URL, it works?

    I’ll dig into the code and see if I can find the issue.

    #579855
    Mike

    Yes sir, removing / and it works, just like the green and blue buttons.

    I also tried disabling Autoptimize, no difference.

    I then deactivated every single plugin I have (Autoptimize, Max Mega Menu, Smart Slider 3), leaving only GP of course:), no difference either.

    #580150
    Tom
    Lead Developer
    Lead Developer

    Thanks for the additional info – will look into it ASAP 🙂

    #581851
    Mike

    Is this something that happens with my site only? Do full path links with hash tags like http://yoursite.com/#link with the new GP smooth-scroll class added and smooth-scroll enabled work for everyone else?

    #582208
    Tom
    Lead Developer
    Lead Developer

    The full URL like that should work fine.

    On your site, it seemed you only had a slash in front of the anchor.

    #582251
    Mike

    Changed to full URL and doesn’t work. It was actually through the full URL that I found out it didn’t work…

    Anything except straight away #tag doesn’t seem to work.

    #582259
    Tom
    Lead Developer
    Lead Developer

    That’s really strange – here’s what I’m getting: http://tomusborne.com/dev/?page_id=13766

    I wonder if there’s a conflicting smooth scroll script on your site?

    #582277
    Mike

    I solved it—by upgrading to GP Premium 1.6.2 from 1.6.1. I just realized I was still on 1.6.1 because I run IIS and have to delete GP/re-install GP every time I want to upgrade GP due to that long directory name bug.

    But I didn’t upgrade because I thought 1.6.2 was the same as 1.6.1 except for the PHP warning for GP sites issue. Because I didn’t have that problem I thought I’d just skip 1.6.2 and wait for 1.6.3.

    But who knows upgrading to 1.6.2 actually solved the problem. Something must have changed between .1 and .2 I guess. What a coincidence.

    Thanks Tom for the effort to look into my issue.

    #582279
    Tom
    Lead Developer
    Lead Developer

    Strange – nothing changed in the script between those two versions. Maybe updating cleared some caches.

    Glad it’s working now 🙂

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