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:
|
||||
|
||||
{{< 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" >}}
|
||||
|
||||
@@ -28,6 +28,9 @@ Map options:
|
||||
height:
|
||||
Height of the map, including CSS units (e.g. "50%", "300px").
|
||||
Optional, defaults to "50vh".
|
||||
resizable:
|
||||
Boolean value indicating whether the map should be drag & drop resizable.
|
||||
Optional, defaults to true.
|
||||
|
||||
Layer options:
|
||||
|
||||
@@ -144,11 +147,13 @@ Elevation profile options:
|
||||
// Create the map
|
||||
var map = Quip.createTrackMap(map_options_{{ $uniqueId }});
|
||||
|
||||
{{ if .Get "resizable" | default "true" }}
|
||||
// Make the map resizable
|
||||
$('#map_container_{{ $uniqueId }}').resizable({
|
||||
handles: 'e, s, se',
|
||||
resize: () => map.invalidateSize(),
|
||||
});
|
||||
{{ end }}
|
||||
|
||||
// Move the Leaflet attribution out of the map container
|
||||
$('#map_attribution_{{ $uniqueId }}').append(
|
||||
|
Reference in New Issue
Block a user