Scroll position restoration not working as expected.
-
We're having difficulties with a Lay Theme installation: After navigating between pages (frontpage → project page and back), the restoration of the previous scroll position does not work as expected. Rather than returning to the position previously scrolled to, the page jumps to some arbitrary position (the same position every time).
There is some custom frontend JavaScript running, but nothing concerning the scroll behavior. Disabling all custom code does not effect the problem, so I'm assuming this is not the problem.
I've tried setting up custom handling for scroll position restoration but whatever the Lay Theme frontend code does in regards to this seems to be overriding it.
How is Lay Theme handling scroll position restoration and what might cause this behavior?
Any help with solving this would be great, navigating the site with this issue is very suboptimal.
Thanks. -
whats the website url?
-
Thanks for the quick reply. Here's the URL: http://patrick-desbrosses.com/
-
This post is deleted!
-
can you send your website address, /wp-admin/ username and password and a link to this topic to info@laytheme.com?
-
ah nevermind
can you update lay theme now?
then it should be fixedi just released a fix for it
anyways, your lay theme version is quite outdated, please always read the blue boxes on the right and do these steps in there
-
Hey hey,
thanks for the update. I've installed the patch and the problem seems mostly solved.
When using the site’s or the browser’s back button, navigation works as expected, the browsers returns to the previous scroll position. When clicking the home link (top left) however, the frontpage loads at some random scroll position. The same happens when reloading the frontpage.
Here’s a video showing the issue: https://drive.google.com/file/d/1eioLdKKg6C9ii18iHyPFCfZbj-DvnFi7/view?usp=sharing
I've tried disabling all custom code, clearing the cache, etc.
-
please disable all of your custom code and try again
lay options → custom html & css → turn off all
im pretty sure your custom code just pushes down the whole site, probably there is some big div that is position relative and then you set it to position absolute or fixed after the html has rendered
when using the back button, the previous scroll position will be restored
however, when just using a link to the frontpage, the scroll position will be 0
if u want the back button to restore scroll position, it should use history back:
https://developer.mozilla.org/en-US/docs/Web/API/History/back -
yea please always check the blue box "before you post"
nice website!
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it