From fc59ed3835031dd20f728b7ea6b96ffec877dac3 Mon Sep 17 00:00:00 2001 From: Robin Date: Thu, 14 Jul 2016 18:38:18 +0200 Subject: [PATCH] Loading works. Positioning works. --- src/app.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/app.js b/src/app.js index 713951b..08934ca 100644 --- a/src/app.js +++ b/src/app.js @@ -2,26 +2,21 @@ const $ = require('dollr/dollr').$; const L = require('leaflet'); +L.Icon.Default.imagePath = 'node_modules/leaflet/dist/images/'; $(function () { console.log('loaded'); $('button').addEventListener('click', function () { console.log('click'); navigator.geolocation.getCurrentPosition((position) => { - console.log(position); + console.log(); + Map.setView([position.coords.latitude, position.coords.longitude], 11); }); }); -}); -L.Icon.Default.imagePath = 'node_modules/leaflet/dist/images/'; - -document.onload = function () { const Map = L.map('map'); - Map.setView([47.63, -122.32], 11); L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © Mapbox', - maxZoom: 18, - id: 'your.mapbox.project.id', - accessToken: 'your.mapbox.public.access.token' + maxZoom: 18 }).addTo(Map); -}; +});