javascript - Back to last scrolled position - jquery mobile page design -


i have simple 1 page architecture. in first page loaded list items. next scrolled list , reached item 60. clicked item , took me second page.

<div data-role="page" id="home">     <div data-role="header" data-position="fixed" data-tap-toggle="false"> <a href="#" class="ui-btn ui-btn-left" id="current">0</a>         <h1>header</h1>         <a href="#" class="ui-btn ui-btn-right" id="total">0</a>     </div>     <div role="main" class="ui-content">         <ul data-role="listview" id="list"></ul>     </div>     <div data-role="footer" data-position="fixed" data-tap-toggle="false">         <h1>footer</h1>     </div> </div> <div data-role="page" id="page2">     <div data-role="header" data-position="fixed" data-tap-toggle="false">          <a href="#home" class="ui-btn ui-btn-left">back</a>         <h1>header</h1>     </div>     <div role="main" class="ui-content">         page     </div>     <div data-role="footer" data-position="fixed" data-tap-toggle="false">         <h1>footer</h1>     </div> </div> 

now when pressed back button in second page brings first page list, scroll position 0. wanted position of 60th item. i'm missing? how in previous page left scrolling?

jsfiddle

watch situation scrolling, press button , press back button.

when navigating 1 page1 page2 scroll position of page1 , when come form page2 page1 set scroll position.

from page 1 page 2

var scrollposition= $("div").scrolltop(); 

and when coming page1. in page 1 ready function

$(document).ready(function(){   $("div").scrolltop(scrollposition);   }); 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -