Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
about lastscroll in the nightly version #1774
Agreed. The scrollback function seems to be broken in beta 1 / latest:
Scroll down, tap Next Page, then tap the browser Back button to return to the first page.
Expected behaviour: JQM scrolls the page down to the Next Page link.
This is on iPhone 4 / iOS 4.3.3.
The scrollback works on 1.0a4.1.
From what it appears... if you create a button instead of a standard link, the last scroll functionality works fine (in my testing environment of Firefox), but if you create a standard link, last scroll does not work properly.
I've been trying to dig through the code to debug this further, but at first glance it's a bit overwhelming.
Well, it appears that a button works because it has the .ui-btn class attached to it. A silly test of adding the ui-btn class to any standard link makes that link work. As for an immediate fix, I simply changed this line:
$activeClickedLink = $link.closest( ".ui-btn" );
... to ...
$activeClickedLink = $link.closest( "a" );
I'm not sure if that's what was intended, but for me, it appears to be doing the job.
So, lastScroll no longer works primarily because we stored the lastScroll data on the page element, which is now removed after pagehide. Also, storing a reference to $activeClickedLink as shown above will simply leak memory on most pages (aside from returning to home), since a page and its child elements are removed from the DOM on pagehide.
I've started a branch (https://github.com/jquery/jquery-mobile/tree/last-scroll) with one commit that does the following.
The diff is here: https://github.com/jquery/jquery-mobile/compare/last-scroll
Feedback is much appreciated. thanks!
I created a page with a listview of 30 items. If you scroll down to the bottom and click on one of the later items, it will display a dialog. When I click out of the dialog, it should take me back to the last scroll position of the first page of listview items. In IE 7 & 8, it doesn't seem to do this.