From 2f160d29c7c0ebe72432f44cb0afb8f4ce66096c Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Wed, 15 Apr 2015 09:05:47 -0600 Subject: [PATCH] Remove jQuery use from geolocation example --- examples/geolocation.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/examples/geolocation.js b/examples/geolocation.js index b50c42aef3..b6b3f70a41 100644 --- a/examples/geolocation.js +++ b/examples/geolocation.js @@ -36,17 +36,21 @@ var geolocation = new ol.Geolocation({ projection: view.getProjection() }); -$('#track').on('change', function() { +function el(id) { + return document.getElementById(id); +} + +el('track').addEventListener('change', function() { geolocation.setTracking(this.checked); }); // update the HTML page when the position changes. geolocation.on('change', function() { - $('#accuracy').text(geolocation.getAccuracy() + ' [m]'); - $('#altitude').text(geolocation.getAltitude() + ' [m]'); - $('#altitudeAccuracy').text(geolocation.getAltitudeAccuracy() + ' [m]'); - $('#heading').text(geolocation.getHeading() + ' [rad]'); - $('#speed').text(geolocation.getSpeed() + ' [m/s]'); + el('accuracy').innerText = geolocation.getAccuracy() + ' [m]'; + el('altitude').innerText = geolocation.getAltitude() + ' [m]'; + el('altitudeAccuracy').innerText = geolocation.getAltitudeAccuracy() + ' [m]'; + el('heading').innerText = geolocation.getHeading() + ' [rad]'; + el('speed').innerText = geolocation.getSpeed() + ' [m/s]'; }); // handle geolocation error.