Info

Scrollerometer

The End

Close

Info

In iOS 4.2, Apple introduced the ability to access the accelerometer via Mobile Safari. Other native iOS applications offer a feature of auto-scrolling forwards and backwards when an iOS device is tilted. With access to the accelerometer data, this same feature can now be achieved in Mobile Safari.

This example was created by @juansanchez with insight from an article by @andytrice and help from @andymcintosh.

Scroll Variables

Variables for tiltForward and tiltBack are dynamic based on accelerometer data while tiltStart is set when the page first loads. The current values for these variables are:

tiltForward:

tiltBack:

tiltStart:

Reset Variables