OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <title>DeviceOrientation test</title> | 3 <title>DeviceOrientation test</title> |
4 <script type="text/javascript"> | 4 <script type="text/javascript"> |
5 var eventCount = 0; | 5 var eventCount = 0; |
6 | 6 |
7 function checkOrientationEvent(event) { | 7 function checkOrientationEvent(event) { |
8 // Return true iff the orientation is close enough to (1, 2, 3). | 8 // Return true iff the orientation is close enough to (1, 2, 3). |
9 return Math.abs(event.alpha - 1) < 0.01 && | 9 return Math.abs(event.alpha - 1) < 0.01 && |
10 Math.abs(event.beta - 2) < 0.01 && | 10 Math.abs(event.beta - 2) < 0.01 && |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 function fail() { | 28 function fail() { |
29 document.location = '#fail'; | 29 document.location = '#fail'; |
30 } | 30 } |
31 </script> | 31 </script> |
32 </head> | 32 </head> |
33 <body onLoad="window.addEventListener('deviceorientation', onOrientation)"> | 33 <body onLoad="window.addEventListener('deviceorientation', onOrientation)"> |
34 <div id="status">FAIL</div> | 34 <div id="status">FAIL</div> |
35 </body> | 35 </body> |
36 </html> | 36 </html> |
OLD | NEW |