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

Flicking to configured 'lock points' #4

Open ahume opened 14 years ago

ahume commented 14 years ago

A small idea for an enhancement.

Could be implemented by adding a new config parameter which defines in pixels the width or height of repeated 'stopping points' along the width or height of the scrollers content.

This would allow reproducing effects similar to what is seen in the native photo gallery apps in iPhone/iPad, where a flick is used to move the interface to the next or previous picture.

Eg, if I passed in {'stopping-width: 300'} then an initial flick to the right will take me 300px into the content (ie a x offset of -300px), a further flick 600px, etc...

davidaurelio commented 14 years ago

Sounds like a good idea – I might add this at a later time. I would like to get other things straight first.

andybeeching commented 13 years ago

If you expose a scrollTo method on TouchScroll instances that accepts an x,y screen co-ordinate (inferred from offsets), then users can define their own grid, and snapto at a point they define (normally TouchEnd, so the default 'flick' action would have to be cancelled.

davidaurelio commented 13 years ago

@jensarps and me hacked preliminary support for this into the stable version with fe9ec73babeb40bcc0e541779686f7d84fa68b5e.

Please try out the feature and report everything that doesn’t work here. Currently it is only possible to flick to a 100% height/width grid. Add {snapToGrid: true} to TouchScroll instantiations.