HTML and CSS Reference
In-Depth Information
Figure 8-2. Gamma positioning for the Device Orientation API
Figure 8-3. Alpha positioning Device Orientation API
One browser-related caveat to remember: older versions of Firefox (3.6, 4, and 5) sup‐
ported mozOrientation versus the standard DeviceOrientation event. You must nor‐
malize the data to radians if you want to match what is currently provided by the newer
specification. Here's how:
if ( ! evt . gamma && ! evt . beta ) {
//If this is Firefox 3.6, 4, or 5, convert
// the degree data to radians
evt . gamma = - ( evt . x * ( 180 / Math . PI ));
evt . beta = - ( evt . y * ( 180 / Math . PI ));
}
 
Search WWH ::




Custom Search