Use custom marker.png for Leaflet map markers
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -40,7 +40,14 @@ function geocodeAndRender(address, mapEl) {
|
||||
subdomains: 'abcd',
|
||||
}).addTo(map)
|
||||
|
||||
L.marker([lat, lon]).addTo(map).bindPopup('<b>' + address + '</b>').openPopup()
|
||||
const icon = L.icon({
|
||||
iconUrl: '/marker.png',
|
||||
iconSize: [40, 40],
|
||||
iconAnchor: [20, 40],
|
||||
popupAnchor: [0, -40],
|
||||
})
|
||||
|
||||
L.marker([lat, lon], { icon }).addTo(map).bindPopup('<b>' + address + '</b>').openPopup()
|
||||
})
|
||||
.catch(() => {
|
||||
mapEl.innerHTML = '<div style="display:flex;align-items:center;justify-content:center;height:100%;background:#f3f4f6;"><p style="font-weight:700;color:#9ca3af;">Carte indisponible</p></div>'
|
||||
|
||||
Reference in New Issue
Block a user