From ec91384e9a5ec29fb8e0b14f5189765f3f4b2a32 Mon Sep 17 00:00:00 2001 From: Sitt Min Oo Date: Thu, 14 Feb 2019 19:34:55 +0100 Subject: [PATCH] added mousehovers for marker popups --- app/templates/maps.html | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/templates/maps.html b/app/templates/maps.html index 223f0f7..5391141 100644 --- a/app/templates/maps.html +++ b/app/templates/maps.html @@ -66,9 +66,15 @@ lat = data.features[0].geometry.coordinates[1]; lon = data.features[0].geometry.coordinates[0]; - L.marker([lat, lon], {icon: marker_icon}).addTo(map) - .bindPopup(location.name + ', ' + location.address) - .openPopup(); + let marker = L.marker([lat, lon], {icon: marker_icon}).addTo(map) + .bindPopup(location.name + ', ' + location.address); + + marker.on('mouseover', function(env) { + marker.openPopup(); + }); + marker.on('mouseout', function(env){ + marker.closePopup(); + }); } };