I have problem to display text when mouseover certain point. This is my code:
for(var e=0;e<xmlStation.getElementsByTagName("station").length;e++) {
var lat=xmlStation.getElementsByTagName("station")[e].getAttribute("lat");
var lon=xmlStation.getElementsByTagName("station")[e].getAttribute("lon");
// Posiziona l'icona dell'evento nel punto di coordinate
// Legge le varie proprietà dell'evento
var stat=xmlStation.getElementsByTagName("station")[e].getAttribute("code");
var Network=xmlStation.getElementsByTagName("station")[e].getAttribute("netid");
var center=xmlStation.getElementsByTagName("station")[e].getAttribute("source");
var loc=xmlStation.getElementsByTagName("station")[e].getAttribute("name");
var image = L.icon({
iconUrl: imagename,
iconSize: [magvis, magvis],
iconAnchor: [(magvis)/2, (magvis)/2]
});
var markerPos = new L.LatLng(lat,lon);
var LMarker = new L.marker(markerPos,{icon:image}).bindPopup(info,{maxWidth: "auto"}).on('mouseover', function (e) {
Popup = L.popup()
.setLatLng(markerPos)
.setContent('Centro di acquisizione = '+center+'<br>'+'Network = '+Network+'<br>'+'Codice Stazione = '+stat+'<br>'+'Località = '+loc)
.openOn(mymap);
}).addTo(mymap)
ArrayStation.push(LMarker);
}
for(var e=0;e<xmlStation.getElementsByTagName("station").length;e++) {
mymap.removeLayer(ArrayM[e]);
}
makeshake=true;
});
When I try to execute, it set the image in right position, but on event on mouseover it repeat only the last element. Why do it happen?