-
Notifications
You must be signed in to change notification settings - Fork 0
/
testo.html
36 lines (30 loc) · 820 Bytes
/
testo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<html>
<head>
<title>orientationchange</title>
</head>
<body>
<p id="test">angle</p>
<script type="text/javascript">
function orientationHandler() {
var orientation = window.orientation;
switch (orientation) {
case 0:
case 90:
case -90:
case 180:
document.getElementById("test").innerHTML = orientation;
break;
default:
document.getElementById("test").innerHTML = "oh my god~";
break;
}
}
alert(window.DeviceOrientationEvent);
window.addEventListener("orientationchange", orientationHandler, true);
function deviceorientationHandler() {
alert("deviceorientationHandler");
}
window.addEventListener("deviceorientation", deviceorientationHandler, false);
</script>
</body>
</html>