Triggering marker mouseover from outside the map

2,637 views
Skip to first unread message

koichirose

unread,
Mar 28, 2010, 2:12:56 PM3/28/10
to Google Maps JavaScript API v3
I have a set of 10 markers displayed on a map, and information about
these markers below the map.

How can I trigger a hover on a marker (currently working) when I'm
hovering on the elements (divs) below the map?

Some code:
//the very simplified code below is called in a for - in the end I'll
have ten markers and ten divs below the map
var marker = new google.maps.Marker({
position: marker_obj.latlng,
icon: image,
map: map,
tooltip: marker_obj.name,
marker_id: marker_obj.id
});
markers.push(marker);

jQuery("<div/>", {
id: "markers_txt_"+marker_id,
html: 'some_text'
}).appendTo("#markers_txt_list").hover(function(){
// I guess I have to trigger the mouseover on the marker here
}, function() {
// and mouseout here
});

Thank you!!

Message has been deleted

Esa

unread,
Mar 28, 2010, 3:24:35 PM3/28/10
to Google Maps JavaScript API v3
You can trigger 'mouseover' event of a marker by:

google.maps.event.trigger(marker, 'mouseover');

Like in this example:

http://koti.mbnet.fi/ojalesa/boundsbox/tiptool_trains.htm

koichirose

unread,
Mar 29, 2010, 4:48:44 AM3/29/10
to Google Maps JavaScript API v3
This is the example I was looking for.
Thank you very much
Reply all
Reply to author
Forward
0 new messages