Code & the internet

Tilt

Accelerometer scroll plugin

View the Demo and Download

Tilt is a jQuery plugin that uses the accelerometer in modern devices to scroll an element.  It makes use of the new Device Motion API.

The Device Motion is only available in the latest browsers (at the time of writing, only Safari Mobile >= version 4.3)

Version 1.0 currently has the following features:

  • Scroll a div when tilting the device left or right
  • Ability to set sensitivity

How to use

  1. Download the zip file here.
  2. Unzip and upload the files to your web server
  3. Make sure you include tilt.min.js or tilt.js on your page
  4. Call joolbar on an element as a normal plugin:
<script type="javascript">
$("#ADiv").tilt();
</script>
Options:
You may pass a sensitivity parameter to modify how quickly the plugin will scroll.  The higher the parameter, the quicker it will scroll (defaults to 1).
<script type="javascript">
$("#ADiv").tilt({sensitivity: 10});
</script>

For more information take a look at the example here.

Requirements

Version 1.0 requires jQuery 1.4.2 to run correctly.  You can download jQuery here.

Licencing

This plugin is released under the GPL3 Licence, allowing free distribution of the plugin according to the terms outlined in the LICENCE file included in the download.

View the Demo and Download

Previously

Building a PHPDoc parser in PHP

This is the second in a series of posts about how I built Doqumentor – The Runtime PHP Documen


Using the PHP Reflection API to document your code

I have recently spent a bit of time writing a new PHP development tool for documenting code at runti


Exploring the iPhone’s accelerometer through Javascript

The iPhone has had an accelerometer in it since the start, allowing users to tilt the device and it