Navigate to the last scroll position when coming back to the homepage
-
After viewing a projet, I would like to come back to the homepage previous scrolled position when I press my browser back button (history.back()). Since I have a lot of projects displayed on my home, it's quite annoying for the user to come back to the top of the page.
Is there a way I can get around this? I guess using Lightbox addon would do the job, but I would prefer having one page (with a proper url) per project.
If anyone had any idea it would be super nice !
Thanks a lot
Johan -
Any clue @mariusjopen ? It's for Simon Koy's website http://simonkoy.de
-
Hey Johan!
Oh, so normally this works, but only on pages where theres no project thumbnail overview grid.
I need to improve this!
-
@arminunruh Thanks a lot for your answer. Is there a trick I should use until you implement this functionality?
-
I tried something like :
jQuery(document).ready(function($) { $('a.thumb').on('click', function(){ sessionStorage["scrollPosition"] = $(window).scrollTop(); }); $(window).scrollTop(sessionStorage["scrollPosition"]); sessionStorage.clear(); });
but it doesn't work.
-
Hi @Johan
have a look how to deal with Javascript here:
http://laytheme.com/documentation.html#custom-javascriptI hope that will work out for you.
All the best!
Marius
-
@mariusjopen Thanks a lot. I will find a way !
-
Hi Johann,
did you made it work .. searching for a solution here. THX Lukasz
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