davidaurelio / TouchScroll

TouchScroll is a JavaScript- and CSS 3-based scroller for devices using Webkit Mobile. It is meant to mimic “native” scrolling feeling and behavior as much as possible.
http://uxebu.com/blog/2010/04/27/touchscroll-a-scrolling-layer-for-webkit-mobile/
BSD 2-Clause "Simplified" License
474 stars 61 forks source link

Touchscroll can break on content change #11

Open tmurison opened 13 years ago

tmurison commented 13 years ago

Procedure:

1) Create a long content layout 2) Scroll down to the bottom 3) Relayout the page to make it much shorter

Result:

Touchscroll does not scroll back up the page giving the effect of a blank page. Furthermore, it is impossible to scroll back up.

lawpower commented 13 years ago

Just like to second this as a problem. I've got a page which loads a list of items dynamically based on user action. Tapping the link loads shorter content with ajax in the same div.

The way I "fixed" this is with a min-height of the div being taller than the viewport (I use 500px). This still loads a blank page but with some swipes I can scroll to the content.

In an ideal world, there'd be a method called touchScrollTo or something I could call on the div whenever I load new content, which would reposition things at the top.

A demo of the issue can be found at http://mobile.trioutnc.com/scroll.html, scroll to the bottom, load more locations a few times, the tap a location name.

Love the script, other than this oddity it's been awesome to work with. Thanks!

ajpalma commented 13 years ago

Hi David, On the page: http://uxebu.com/blog/2010/04/27/touchscroll-a-scrolling-layer-for-webkit-mobile/ You give a potential fix for this issue. You said "At the moment you can use “scroller.scrollTo(0, 0)” – on the scroller instance" I have this issue and don't totally understand your response. where do we put this code in exactly? Can you show an example? Thanks, Palma