Cleanup JS
This commit is contained in:
parent
1899ae758b
commit
3e7e68d33a
3 changed files with 6 additions and 15 deletions
|
@ -15,7 +15,6 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<img src="img/compass.png" id="compass"/>
|
<img src="img/compass.png" id="compass"/>
|
||||||
<h1 id="heading"></h1>
|
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
<a class="btn btn-success btn-lg">Continue</a>
|
<a class="btn btn-success btn-lg">Continue</a>
|
||||||
|
|
|
@ -1,18 +1,9 @@
|
||||||
jQuery.fn.rotate = function(degrees) {
|
import './utils';
|
||||||
$(this).css({
|
|
||||||
'-webkit-transform' : 'rotate('+ degrees +'deg)',
|
|
||||||
'-moz-transform' : 'rotate('+ degrees +'deg)',
|
|
||||||
'-ms-transform' : 'rotate('+ degrees +'deg)',
|
|
||||||
'transform' : 'rotate('+ degrees +'deg)'
|
|
||||||
});
|
|
||||||
return $(this);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
document.addEventListener("deviceready", function () {
|
document.addEventListener("deviceready", function () {
|
||||||
function onSuccess(heading) {
|
function onSuccess(heading) {
|
||||||
$('#compass').rotate(-heading.magneticHeading.toFixed(0));
|
$('#compass').rotate(-heading.magneticHeading.toFixed(2));
|
||||||
$('#heading')[0].innerHTML = -heading.magneticHeading.toFixed(0);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function onError(compassError) {
|
function onError(compassError) {
|
||||||
|
@ -20,8 +11,9 @@ document.addEventListener("deviceready", function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
frequency: 1
|
frequency: 100
|
||||||
};
|
};
|
||||||
|
|
||||||
var watchID = navigator.compass.watchHeading(onSuccess, onError, options);
|
var watchID = navigator.compass.watchHeading(onSuccess, onError, options);
|
||||||
|
|
||||||
}, false);
|
}, false);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
@import "node_modules/bootstrap/less/theme";
|
@import "node_modules/bootstrap/less/theme";
|
||||||
@import "node_modules/ionicons/less/ionicons";
|
@import "node_modules/ionicons/less/ionicons";
|
||||||
@import "node_modules/less-mixins/index";
|
@import "node_modules/less-mixins/index";
|
||||||
@import url(https://fonts.googleapis.com/css?family=Roboto:400,300,400italic,700);
|
// @import url(https://fonts.googleapis.com/css?family=Roboto:400,300,400italic,700);
|
||||||
@import (inline) "node_modules/animate.css/animate.css";
|
@import (inline) "node_modules/animate.css/animate.css";
|
||||||
|
|
||||||
* {
|
* {
|
||||||
|
|
Reference in a new issue