cordova - jQuery Mobile - Maintain scroll position on device orientation change? -


I am using jQuery-mobile to display a list of data. The list can be quite long, say ~ 3000 pix. The problem I see on my Samsung GS5 , when I rotate the phone, the list view loses its scroll position and is located at the top

I tried to do the following but could not get it working:

  // This list is meant to rotate the device when viewing the list $ (window) ('Scrollstop', function () (if ($ .mobile.activePage.attr ('id') == 'page viewed') {self.currentScroll = $ (window) .scrollTop ();}} ); $ (Window) .on ("orientation", function (event) {if ($ .mobile.activePage.attr ('id') == 'page seen') {console.log ('Scroll Pos : '+ Self.currentScroll); $ (window) .scrollTop (self.currentScroll); // also tried to use jQM silent scrolling method here. No luck.}});  

Logically, this should work, it captures the scroll position on the fly, A. When you rotate the device, then it should be taken back to the place where it was. But for me, I can not understand why this is not working. Do anyone have any ideas / suggestions? >

You can divs on firebug and make sure that The element is in that scrollbar, sometimes it happens that body , page and ui-content to 100% Is set at the height and this New scroll bar ui-content if ends div case, you can directly access scrollTop () can Scolbar the Diva.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -