Squashed commit of the following:
commit92c55c5705
Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Thu Jun 16 23:26:41 2016 +0100 Update resource links commita72719dc24
Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Thu Jun 16 23:18:44 2016 +0100 Move hand-made js to resources
This commit is contained in:
parent
292427d485
commit
5ec516ab19
85 changed files with 1303 additions and 571 deletions
16
resources/assets/js/maps.js
Normal file
16
resources/assets/js/maps.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
/* global L */
|
||||
//This code runs on page load and looks for <div class="map">, then adds map
|
||||
var mapDivs = document.querySelectorAll('.map');
|
||||
for (var i = 0; i < mapDivs.length; i++) {
|
||||
var mapDiv = mapDivs[i];
|
||||
var latitude = mapDiv.dataset.latitude;
|
||||
var longitude = mapDiv.dataset.longitude;
|
||||
L.mapbox.accessToken = 'pk.eyJ1Ijoiam9ubnliYXJuZXMiLCJhIjoiVlpndW1EYyJ9.aP9fxAqLKh7lj0LpFh5k1w';
|
||||
var map = L.mapbox.map(mapDiv, 'jonnybarnes.gnoihnim')
|
||||
.setView([latitude, longitude], 15)
|
||||
.addLayer(L.mapbox.tileLayer('jonnybarnes.gnoihnim', {
|
||||
detectRetina: true
|
||||
}));
|
||||
L.marker([latitude, longitude]).addTo(map);
|
||||
map.scrollWheelZoom.disable();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue