Luke Hagan

jQuery iOS Shake

Access the iPhone accelerometer from your webapp.

Ever wanted your webapp to detect the user shaking their iOS device? With iOS 4.2+, this magic is no longer limited to native apps – now you can add shake detection (and lots of other things) thanks to accelerometer access in Safari!

As part of a much bigger project soon to be released[^1], I put together a really simple to use, customizable “shake detection” plugin for jQuery. Fork it on GitHub or just try it out on the demo page[^2]. It’s certainly not the only implementation out there, but I like it best because, well, I put a bunch of time into it.

[^1]: More on that in the coming weeks.

[^2]: My apologies for the lack of style on the demo page.