I want to add a feature to an existing website thats built using the Zend Framework. One of the problems with this website is that it refreshes the page often at different positions on the web page. What I would like to do is use a built-in Zend framework function to keep the same position in a web page after it has been refreshed.
An example would be: A user clicks at the bottom of the page, the same page is reloaded but it does not reload at the top of the page, it stays where the user last clicked.
Is there such a thing?
Thank you
You could use some javascript to record the scroll position of the window right before a refresh, and just save it to a cookie.
Then, when the next page loads, check for the cookie, scroll to its position, and delete it. This won’t work well if the webpage has dynamically sized elements(example: an expanding accordion menu).
Personally though, I would try to avoid this. Every now and then I visit some website that likes to do stuff with my scroll bar and try to help me. Way too often they get it wrong and the webpage becomes unusable. Maybe you can just dynamically update the page(ajax?) instead of doing a real reload.