24 lines
971 B
HTML
24 lines
971 B
HTML
{{ $mapLat := default "" .mapLat }}
|
|
{{ $mapLon := default "" .mapLon }}
|
|
{{ $zoom := default "13" .zoom }}
|
|
{{ $mapWidth := default "100%" .mapWidth }}
|
|
{{ $mapHeight := default "400px" .mapHeight }}
|
|
{{ $mapId := default (md5 (printf "%s%s" $mapLat $mapLon)) .mapId }}
|
|
{{ $scrollWheelZoom := default "true" .scrollWheelZoom }}
|
|
|
|
<!--Container-->
|
|
<div id='mapid_{{ $mapId }}' class="leaflet-map" width="{{ $mapWidth }}" style='height: {{ $mapHeight}};'></div>
|
|
|
|
<script>
|
|
//Create Map
|
|
leafletMapsObj[{{ $mapId }}] = L.map('mapid_{{ $mapId }}').setView([{{ $mapLat }}, {{ $mapLon }}], {{ $zoom }});
|
|
{{ if eq $scrollWheelZoom "false" }}
|
|
leafletMapsObj[{{ $mapId }}].scrollWheelZoom.disable();
|
|
{{ end }}
|
|
//Add tiles
|
|
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
|
}).addTo(leafletMapsObj[{{ $mapId }}]);
|
|
|
|
</script>
|