views:

155

answers:

1

I have succeeded in loading a Google map using the gMap jQuery plugin and making it display several markers passed to it in a JSON object using the pattern demonstrated here under "Map with marker and info window". So far, so good.

Now I want to have a link on the same page which, when clicked, displays the info window for a marker on the map.

How is this done?

+1  A: 

You need to store a reference to the marker when you create it and then call marker.openInfoWindow(htmlContent) on the click-event of the link.

nikc
Since I am using the gMap plugin, I don't have access to the marker when it's created. Is there no way to reference the marker after?
Keyslinger
I took a quick look at the plugin you're using, and it doesn't seem to store the markers anywhere, but simply adds them to the map object. You could either modify the plugin to store the markers or take a look at the Google Map API for another solution. http://code.google.com/apis/maps/documentation/javascript/reference.html
nikc