Archived topic
Smooth Scroll from one page to another
5 replies · Started by Stefan on August 8, 2018
Hey,
I've searched the forum but I couldn't find a proper solution.
I have some links/btns that lead to a section on another page.
So for example: <a href="name.com/page/#section">Link</a>
Because of the sticky header, the section heading gets covered. Therefore a offset would be great. If it could be with smooth scroll it would be perfect. I tried to add the smooth-scroll class but it didn't worked.
I've already found and tested a pure css solution with background-clip but it killed all my distances. I thought there is a more elegant way maybe.
Any ideas?
Hi there,
Can you make sure that smooth-scroll class is added to the link itself and not the button?
https://generatepress.com/forums/topic/smooth-scroll-not-getting-applied/#post-632889
Let me know :)
Hi Leo,
tried it again, not working.
This is similar to my css:
<div class="rc-cta cta">
<a href="http://localhost/test_site/cat/#single" class="btn btn-yellow smooth-scroll">Learn More</a>
</div>
When it's on the same site it works perfect. The problem is from one to another.
Unfortunately our smooth scroll script doesn't work from one page to another.
However, you might be able to use something like this: https://stackoverflow.com/a/9805747/2391422
Thanks for the source Tom.
I've tried a few things but sadly I can't get it to work. Maybe some conflict here I can't grasp.
From what I understand ajax might be a good way to go. But my dev skills are not good enough at the moment.
Sometime I'll dig deeper but I leave it for now.
No problem. Let me know if you find anything :)