forked from 1d10t/test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompass.html
More file actions
29 lines (27 loc) · 998 Bytes
/
Copy pathcompass.html
File metadata and controls
29 lines (27 loc) · 998 Bytes
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
<html><head>
<script src="//ai.github.io/compass.js/compass.js"></script>
<script>
window.onload = function(){
Compass.noSupport(function () {
compass.style.display="none";
});
Compass.needGPS(function () {
go_outside_message.style.display="block"; // Step 1: we need GPS signal
}).needMove(function () {
go_outside_message.style.display="none";
move_and_hold_ahead_message.style.display="block"; // Step 2: user must go forward
}).init(function () {
move_and_hold_ahead_message.style.display="none"; // GPS hack is enabled
});
Compass.watch(function (heading) {
degrees.innerText = heading;
compass.style.transform = 'rotate(' + (-heading) + 'deg)';
});
}
</script>
</head><body>
<div id="compass" style="display: none;">compass</div>
<div id="go_outside_message" style="display: block;">go-outside-message</div>
<div id="move_and_hold_ahead_message" style="display: none;">move-and-hold-ahead-message</div>
<div id="degrees">degrees</div>
</body></html>