Created
June 5, 2013 23:21
-
-
Save steveosoule/5718084 to your computer and use it in GitHub Desktop.
JavaScript Device Orientation
This file contains hidden or 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
// http://daker.me/2013/06/5-html5-javascript-apis-to-keep-an-eye-on.html | |
if (window.DeviceOrientationEvent) { | |
window.addEventListener('deviceorientation', function(event) { | |
var a = event.alpha, | |
b = event.beta, | |
g = event.gamma; | |
console.log('Orientation - Alpha: ' + a + ', Beta: '+ b + ', Gamma: ' + g); | |
}, false); | |
} else { | |
console.log('This device does not support deviceorientation'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment