I have been using the jquery appear plugin for some time now, but it appears I have a problem.
This is how I do it at the moment.
I have a page of indefinite length. It is a list of hidden SPANs with only the first one visible. The HTML is loaded onto these SPANs from OnAppear event handler. In that same event handler I make the next SPAN visible by setting it’s style.display property.
Everything works well except when the following senario arises.
Suppose the user have been scrolling page down for some time, and accumulated quite a bit of content on it (loaded by OnAppear event handler). He picks one item and opens a detailed view, and that’s a different page. After looking at the detailed view the user wants to go back to the list, and clicks the BACK button in the browser.
The browser tries to use the cached version of the page scrolled a way down.
But all the content loaded by OnAppear is missing. The user sees the bottom of very long empty page.
My question is: is there a proper pattern for using the jquery Appear plugin to handle this situation nicely ?
Ie. when the user comes back to the page through Browser’s BACK button, I want the user to see a single SPAN with content loaded in it. If the user scrolls UP or down from that position on the page, the usual OnAppear processing would take place.
I’d suggest saving the position the user scrolled down to in the session or likewise and have the content react accordingly. You won’t be able to influence that browser behavior, it will always try to reproduce the position the user was last at.