Do you really want to include a 176kb framework (yes, AdLib is that big, minified) into your application just to have a scrolling region? Your whole application is probably smaller than that. (Also note that you can’t probably redistribute AdLib, but it was just an example).
I don’t hate frameworks, I love them actually when they are well done. Developers are lazy (myself included) and clients are stingy, so frameworks merge these two devastating factors and make everybody happy.
In my very humble opinion we have not reached the point where we can ignore speed and size optimization on mobile devices. You can probably give any kind of framework to your desktop browser, but not to your mobile device. CPU cycles are precious on smartphones (and tablets), you cannot waste them.
The solution would be to create a serie of specialized, optimized and reusable micro-frameworks, snippets of code and widgets in the do-one-thing-and-do-it-well philosophy. Starting today this is my mission.
Now get back to the raison d’être of this post. iScroll has been updated to 3.4. The news are:
- The shrinking scrollbars are back. When you swipe the contents outside of the boundaries the scrollbars reduce in size (as in native iPhone applications, on Android this feature is disabled by default). It’s a very rough code but iOS4 will be out soon, many things will change and there’s no reason to invest time in a code that could be obsolete in 4 days.
- Preliminary desktop browser compatibility. iScroll already works flawlessly on your desktop browser. If no touch event is found you can freely scroll your content the old fashioned way (ie: drag the scrollbar). Mostly for debug purposes you can now force the
desktopCompatibilityparameter and on Safari and Chrome you’ll get the same behavior as on a touch enabled device (ie: swipe and momentum). I’ll probably add Firefox compatibility in the near future.
- Better momentum. A quick note about this one. iScroll uses a pre-calculated momentum formula to save resources. I don’t use timers (most of the other frameworks use them), the script is probably less flexible but performance-wise is unbeatable.