Re: multiple marker snafu
I'm not really a JavaScript programmer so I don't see the problem in
your code. I had a similar problem early in my map development and
managed to resolve it. One way was to always create new markers into a
local variable (your array should also have fixed this). Another way
was not to have a separate listener for each marker. I add my own html
string to each marker like this:
{
var marker= new GMarker(new GPoint(Vlong,Vlat),picon); //create
a new one
marker.imageID=id;
marker.imageHTML=html;
map.addOverlay(marker);
markers.push(marker); //save the markers in an array
}
And then I have one listener for the map that checks for overlays and
displays the info winndow for each one:
GEvent.addListener(map, 'click',
function(overlay, point)
{
if (overlay)
{
if (overlay.imageHTML) //if it has one of my html strings,
{
overlay.openInfoWindowHtml(overlay.imageHTML);
}
}
}
);
See it working at http://www.kayaker.net/php/gmapimage.html
0 Comments:
Yorum Gönder
<< Home