0

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

Gijs vK
  • 21
  • 1
  • 2
  • 4
  • WHat has this got to do with PHP or IOS – RiggsFolly Oct 02 '18 at 08:21
  • What do you want to do here? As far as I can tell, your intention is to listen for mouseover on a marker, and switch an InfoWindow from one marker to another. I can't tell what you mean by "multiple InfoWindows", though, so I feel like you need to be more specific/expand upon the behavior you want from your code. – blahman Oct 02 '18 at 23:51
  • hi blahman, I edited my question to give more background. Hope you can help... – Gijs vK Oct 07 '18 at 15:58

0 Answers0