Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
@cgack
64 lines (56 sloc) 1.724 kb
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this file,
- You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE html>
<html manifest="compass.appcache">
<head>
<meta charset=utf-8 />
<title>Cardinal Direction Compass</title>
<style>
.pointer {
height: 0;
width: 0;
border-left: 2em solid transparent;
border-right: 2em solid transparent;
border-bottom: 8em solid black;
margin: -10px 0 0 -40px;
top: 40%;
left: 50%;
position: absolute;
}
.n {
top: 20%;
left:50%;
position:absolute;
font:5em Helvetica;
margin: 0 0 0 -40px;
}
</style>
<script src="js/jquery.js"></script>
</head>
<body>
<div class="n">N<br><br><br><br>S</div>
<div class="pointer"></div>
<script>
$(document).ready(function() {
var rotate = function (deg) {
$(".n").css({ "-moz-transform": "rotate(0deg)"});
$(".n").css({ "-moz-transform": "rotate(" + deg + "deg)"});
$(".n").css({ "-o-transform": "rotate(0deg)"});
$(".n").css({ "-o-transform": "rotate(" + deg + "deg)"});
$(".n").css({ "-ms-transform": "rotate(0deg)"});
$(".n").css({ "-ms-transform": "rotate(" + deg + "deg)"});
$(".n").css({ "-webkit-transform": "rotate(0deg)"});
$(".n").css({ "-webkit-transform": "rotate(" + deg + "deg)"});
$(".n").css({ "transform": "rotate(0deg)"});
$(".n").css({ "transform": "rotate(" + deg + "deg)"});
};
if (window.DeviceOrientationEvent) {
window.addEventListener("deviceorientation", function (e) {
rotate(360 - e.alpha);
}, false);
}
});
</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.