Hello,

I'm trying to open a simple InfoWindow on click on a marker. The marker
(s) have been set by the GDirections() method and I'm reading the
markers like this:

var directions = new GDirections(map);
var markers[0] = directions.getMarker(0);

The problem is, that the map shows me on click the small zoomed map
instead of the infowindow. I've figured out, that I'm setting the
eventhandler "too early" but I can't see how to do it differently.
Here's a bit of code.

function initialize()
{
        map = new GMap2(document.getElementById("map_canvas"));
        map.addControl(new GSmallMapControl());
        directionsPanel = document.getElementById("route");
        directions = new GDirections(map);
        directions.load("from: Address 1 to: Address 2");
        GEvent.addListener(directions.getMarker(0), "click", function() {
                directions.getMarker(0).openInfoWindowHtml('<p>Text here and 
here</
p>');
        });
}

$(window).ready(function()
{
        initialize();
});

If I'm placing the event in it's own method and call it e.g. from a
console, everything works fine.

Any ideas how I could fix this?

Cheers,
—trice

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to