Created
September 18, 2013 02:08
-
-
Save sumaolin/6603558 to your computer and use it in GitHub Desktop.
实现一下webapp的手机摇一摇功能
From http://blog.stevezheng.com/903
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function handleMotionEvent(event) { | |
var x = event.accelerationIncludingGravity.x; | |
var y = event.accelerationIncludingGravity.y; | |
var z = event.accelerationIncludingGravity.z; | |
// Do something awesome. | |
} | |
window.addEventListener("devicemotion", handleMotionEvent, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment