mirror of
https://gitlab.com/mrubli/hugo-mod-leaflet.git
synced 2025-10-07 01:54:24 +00:00
layouts: map: Add option to make map non-resizable
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Syntax summary:
|
Syntax summary:
|
||||||
|
|
||||||
{{< leaflet-map centerLat=FLOAT centerLon=FLOAT zoom=INT width="STRING" height="STRING" >}}
|
{{< leaflet-map centerLat=FLOAT centerLon=FLOAT zoom=INT width="STRING" height="STRING" resizable=BOOL >}}
|
||||||
|
|
||||||
{{< leaflet-layer id="STRING" apiKey="STRING" >}}
|
{{< leaflet-layer id="STRING" apiKey="STRING" >}}
|
||||||
|
|
||||||
@@ -28,6 +28,9 @@ Map options:
|
|||||||
height:
|
height:
|
||||||
Height of the map, including CSS units (e.g. "50%", "300px").
|
Height of the map, including CSS units (e.g. "50%", "300px").
|
||||||
Optional, defaults to "50vh".
|
Optional, defaults to "50vh".
|
||||||
|
resizable:
|
||||||
|
Boolean value indicating whether the map should be drag & drop resizable.
|
||||||
|
Optional, defaults to true.
|
||||||
|
|
||||||
Layer options:
|
Layer options:
|
||||||
|
|
||||||
@@ -144,11 +147,13 @@ Elevation profile options:
|
|||||||
// Create the map
|
// Create the map
|
||||||
var map = Quip.createTrackMap(map_options_{{ $uniqueId }});
|
var map = Quip.createTrackMap(map_options_{{ $uniqueId }});
|
||||||
|
|
||||||
|
{{ if .Get "resizable" | default "true" }}
|
||||||
// Make the map resizable
|
// Make the map resizable
|
||||||
$('#map_container_{{ $uniqueId }}').resizable({
|
$('#map_container_{{ $uniqueId }}').resizable({
|
||||||
handles: 'e, s, se',
|
handles: 'e, s, se',
|
||||||
resize: () => map.invalidateSize(),
|
resize: () => map.invalidateSize(),
|
||||||
});
|
});
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
// Move the Leaflet attribution out of the map container
|
// Move the Leaflet attribution out of the map container
|
||||||
$('#map_attribution_{{ $uniqueId }}').append(
|
$('#map_attribution_{{ $uniqueId }}').append(
|
||||||
|
Reference in New Issue
Block a user