google maps v3 marker info window on mouseover

Google MapsGoogle Maps-Api-3Google Maps-MarkersMouseoverGoogle Fusion-Tables

Google Maps Problem Overview


I have scoured stackoverflow and other forums including the google maps v3 api docs for an answer but I cannot find how to change the event that fires the marker info window from click to mouseover in the files I am working with.

I am working with a demo from the google library that includes a fusion table layer.

You zoom into the clusters and see the small red circle markers for locations. You have to click to reveal an info window. I wish to rollover to reveal the info window.

My demo is here: <http://www.pretravelvideo.com/gmap2/>

The functions.js file does most of the work here: <http://www.pretravelvideo.com/gmap2/functions.js>

Google Maps Solutions


Solution 1 - Google Maps

Here's an example: http://duncan99.wordpress.com/2011/10/08/google-maps-api-infowindows/

marker.addListener('mouseover', function() {
	infowindow.open(map, this);
});

// assuming you also want to hide the infowindow when user mouses-out
marker.addListener('mouseout', function() {
	infowindow.close();
});

Solution 2 - Google Maps

var icon1 = "imageA.png";
var icon2 = "imageB.png";

var marker = new google.maps.Marker({
    position: myLatLng,
    map: map,
    icon: icon1,
    title: "some marker"
});

google.maps.event.addListener(marker, 'mouseover', function() {
    marker.setIcon(icon2);
});
google.maps.event.addListener(marker, 'mouseout', function() {
    marker.setIcon(icon1);
});

Solution 3 - Google Maps

Thanks to duncan answer, I end up with this:

marker.addListener('mouseover', () => infoWindow.open(map, marker))
marker.addListener('mouseout', () => infoWindow.close())

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAdam FletcherView Question on Stackoverflow
Solution 1 - Google MapsduncanView Answer on Stackoverflow
Solution 2 - Google MapspankajView Answer on Stackoverflow
Solution 3 - Google MapsDamian PavlicaView Answer on Stackoverflow