});
{/if}
+ var mapContainerWidth = Number(leafletMap._container.clientWidth);
+ var maxPopupWidth = .65 * mapContainerWidth;
+ if (maxPopupWidth > 600) {
+ maxPopupWidth = 600;
+ }
+ var mapContainerHeight = Number(leafletMap._container.clientHeight);
+ var maxPopupHeight = .7 * mapContainerHeight;
{foreach $mapItems as $m}
{if $m.lat != 0 && $m.lon != 0}
// Create marker for this member and and to Feature Group
var leafletMarker = L.marker([{$m.lat}, {$m.lon}], { title: '{$m.member_name|escape:quotes}' })
- .bindPopup($('#map_info_' + {$m.id}).html())
+ .bindPopup($('#map_info_' + {$m.id}).html(), {
+ maxWidth: maxPopupWidth,
+ maxHeight: maxPopupHeight
+ })
.addTo(markerGroup);
{/if}
leafletMap.on('popupopen', function(e) {
var px = leafletMap.project(e.popup._latlng);
- px.y -= e.popup._container.clientHeight/2;
+ px.x -= 20; // Bump a bit to the right to avoid resize buttons
+ px.y -= e.popup._container.clientHeight/2; // Position more toward the center
leafletMap.panTo(leafletMap.unproject(px),{ animate: true });
});