I have a small genealogical database in SQL running on my home NAS. This includes locations which I want to show on a Google map.
I wrote a PHP program that creates the Javascript to first create a map and then add an icon and infowindow for each location (with name and year). On mobile this should popup on clicking the icon. On PC, the Infowindow should ideally pop up on mouseover and be hidden on mouseout.
I tried different ways of writing the “addListener”. Creating one Infowindow was easy but having multiple Infowindows in the same map only worked with the code below (with input from Google site and some StackOverflow articles). Unfortunately it seems to only work on Firefox, not on Chrome and not on Safari... See here.
google.maps.event.addListener(marker,'mouseover', (function(marker,content,infowindow){
return function() {
infowindow.setContent(content);
infowindow.open(map,marker);
};
})(marker,content,infowindow));
google.maps.event.addListener(marker,'mouseout', (function(marker,content,infowindow){
return function() {
infowindow.close();
};
})(marker,content,infowindow));
I’m looking for a way to write this Infowindow addListener so that it works reliably for multiple infowindows across platforms.
Thanx! Gijs.
consulted questions include the demos on Google's site plus: google maps v3 marker info window on mouseover / How to display only one infowindow at a time in google maps api v3