added mousehovers for marker popups

This commit is contained in:
Sitt Min Oo 2019-02-14 19:34:55 +01:00
parent eaf9ba8399
commit ec91384e9a

View file

@ -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();
});
}
};