/TiltScroll

Script to scroll webpage to top on device tilt

Primary LanguageHTMLMIT LicenseMIT

TiltScroll

TiltScroll Example

TiltScroll is a simple, easy-to-use JavaScript library to make your website sensitive event tilting the device and automatically move up.

TiltScroll is developed by StaticKidz.

Compatibility

I tried and tested on the following mobile browsers and devices:

  • Mobile Safari on iOS 8
  • Chrome on iOS 8
  • Chrome on Android (ICS)
  • MacBook (Early 2011) and Chrome

Usage

Include tiltscroll.js in your JavaScript bundle or add it to your HTML page like this:

<script type="application/javascript" src="/path/to/tiltscroll.js"></script>

TiltScroll instantiates automatically, don't worry fot that. In addition, you can override default options.

Options

Change the tilt sensitivity that makes the scroll, by default -15, the posible values its 0 to -180.

TiltScroll({
	deviceSense: -30
});

Or change the scroll duration time in miliseconds:

TiltScroll({
	scrollDuration: 5500
});

Live Demo

You can test this working here.

Credits and collaboration

TiltScroll is maintained by Adrián Barrio Andrés and the original idea was for Eduardo Matias. All open source code released by StaticKidz is licenced under the MIT licence.