Remove jQuery use from device orientation example
This commit is contained in:
@@ -31,15 +31,19 @@ var map = new ol.Map({
|
|||||||
|
|
||||||
var deviceOrientation = new ol.DeviceOrientation();
|
var deviceOrientation = new ol.DeviceOrientation();
|
||||||
|
|
||||||
$('#track').on('change', function() {
|
function el(id) {
|
||||||
|
return document.getElementById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
el('track').addEventListener('change', function() {
|
||||||
deviceOrientation.setTracking(this.checked);
|
deviceOrientation.setTracking(this.checked);
|
||||||
});
|
});
|
||||||
|
|
||||||
deviceOrientation.on('change', function(event) {
|
deviceOrientation.on('change', function(event) {
|
||||||
$('#alpha').text(deviceOrientation.getAlpha() + ' [rad]');
|
el('alpha').innerText = deviceOrientation.getAlpha() + ' [rad]';
|
||||||
$('#beta').text(deviceOrientation.getBeta() + ' [rad]');
|
el('beta').innerText = deviceOrientation.getBeta() + ' [rad]';
|
||||||
$('#gamma').text(deviceOrientation.getGamma() + ' [rad]');
|
el('gamma').innerText = deviceOrientation.getGamma() + ' [rad]';
|
||||||
$('#heading').text(deviceOrientation.getHeading() + ' [rad]');
|
el('heading').innerText = deviceOrientation.getHeading() + ' [rad]';
|
||||||
});
|
});
|
||||||
|
|
||||||
// tilt the map
|
// tilt the map
|
||||||
|
|||||||
Reference in New Issue
Block a user