My solution to scrolling divs

3 views
Skip to first unread message

Matteo

unread,
Jan 4, 2009, 2:39:11 AM1/4/09
to iPhoneWebDev
When I first studied the iphone webkit I was surprised to see that I
could not place fixed position elements and could not scroll contents
inside divs or iframes (with 1 finger gesture). I found a couple of
overcomplicated solutions to this problem on the web so I tried to
code everything from scratch and the result is a not perfect but
functional 4kb script (unminified).

Here a working demo http://cubiq.org/dropbox/iphonescroll.html
(iphone, ipod touch and emulator). If you don't have an iphone at
hand, watch the screencast http://cubiq.org/media/movies/scrolling-div-iphone.mov
.
You'll find some instructions at http://cubiq.org/scrolling-div-on-iphone-ipod-touch/5
and the script itself here http://cubiq.org/dropbox/iscroll.js

Hope it could be of some use.

Matteo

unread,
Jan 7, 2009, 12:06:34 PM1/7/09
to iPhoneWebDev
After fre suggestions from various sources, the script has been
updated. Now all animations are handled by -webkit-transform and we
don't need a timer anymore. Performance are pretty much the same. The
original article has been updated.

On Jan 4, 8:39 am, Matteo <mat...@gmail.com> wrote:
> When I first studied the iphone webkit I was surprised to see that I
> could not place fixed position elements and could not scroll contents
> inside divs or iframes (with 1 finger gesture). I found a couple of
> overcomplicated solutions to this problem on the web so I tried to
> code everything from scratch and the result is a not perfect but
> functional 4kb script (unminified).
>
> Here a working demohttp://cubiq.org/dropbox/iphonescroll.html
> (iphone, ipod touch and emulator). If you don't have an iphone at
> hand, watch the screencasthttp://cubiq.org/media/movies/scrolling-div-iphone.mov
> .
> You'll find some instructions athttp://cubiq.org/scrolling-div-on-iphone-ipod-touch/5
> and the script itself herehttp://cubiq.org/dropbox/iscroll.js
Reply all
Reply to author
Forward
0 new messages