steveosoule
6/5/2013 - 11:21 PM

JavaScript Device Orientation

JavaScript Device Orientation

// 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');
}