joehewitt / scrollability

Imitates iOS native scrolling in JavaScript.
http://joehewitt.github.com/scrollability
Other
1.78k stars 147 forks source link

Pull-to-refresh feature and scroll event #17

Closed endtwist closed 7 years ago

endtwist commented 13 years ago

I needed a pull-to-refresh at the bottom of the list for pagination, so I built it in. I haven't had the need/time to add a top-of-list pull-to-refresh but it would definitely be useful. You just drop an element with the class name "pull-to-refresh" in your scroll list, and it fires events (pullingUp, pulledUp, and pullCancel) automatically.

As well, I've made scrollability emit a scroll event during scrolling. I throttled it to once per every 20ms so that it wouldn't fire too frequently, but often enough that you can do something such as "sticky headers." It doesn't bubble, so it won't interfere with the scrollToTop feature.

I'm not sure if these are "clean enough" solutions. Definitely open to suggestions on how to improve these additions.

joehewitt commented 12 years ago

Cool, this looks good. I may not have a chance to thoroughly test and merge it for a while, but I'll get to it.