How to fix back button when user clicks on link from endless ajax scrolling search results?

I have infinite scrolling on a search results page using ajax.

How can I make it so that when the user clicks a link outside of the site and returns with the back button, the results are scrolled to the ajax loaded portion of the page they exited from?

+1


source to share


2 answers


Google for jQuery ajax history plugins. A lot of them.

also look up the jQuery haschange plugin: http://benalman.com/projects/jquery-hashchange-plugin/



basically you are adding / updating (possibly increasing) the value '# result-set = 1' to the url of the page. Then use the haschange plugin eg. you can run your own code, navigate backward or forward, how many of the results were shown by pagination, etc. When the user clicks the back button and returns to your page, when you turn on the load haschange should work if you are connected up your pagination in the "# ..." in the url

+2


source


Discard unspace writeup its implementation Pageless. They use a special div that moves along with the scroll events and they also use a temporary cookie to store the position.



0


source







All Articles