PDA

View Full Version : swipe scroll



nofx
3 Oct 2011, 6:46 AM
What i'm trying to achieve is the effect when you do a quick swipe over your phone screen, that a panel (or something similair) scrolls down alot (depending on how hard you swiped).

I want to have this effect too in my DIV. I think i can programmatically do it myself, but i was wondering if Sencha Touch already has some build in feature for this?

If i have to do it my self then i'd do it like this:

On touchstart i save the timeStart. Then on touchend, i compare the current time with the timeStart. If the time difference is 1 sec, then i scroll my DIV 100px down.
When the time difference is 0.5 sec, then it scrolls 200px down.
etc.

But when the time difference is larger than 1 sec, then my DIV just scrolls down using the "drag" event (which is currently working too).

Is this a good way to implement such a feature?? Or do you guys know a better way of doing this??