InfoBox has a setContent method for changing the content and a
setPosition method for changing the position.

So in your click handler for a marker you can get the position of the
marker (google.maps.Marker.getPosition()), then pass the result on to
the InfoBox to reposition it at the marker clicked. At the same time,
you can change the content of the InfoBox as well -- to content that
is dependent on the marker that is clicked.

I notice you're using a closure variable (point) to set the position
of the InfoBox. Problem is, you're defining that variable in a loop, a
big no-no. Instead, set the position parameter in boxOptions to
this.getPosition()

I also notice you're creating a new InfoBox every time a marker is
clicked. You should probably creating a single master InfoBox and keep
track of it with a global variable. You can then manipulate it in the
click handler.

Gary

On Apr 14, 10:35 am, Lennart K <[email protected]> wrote:
> Hi, all you keen developers! Can you give me some advice, please.
> I've been trying for some time to creat customs info windows on my
> maps. Finally i managed to get a window with the help of infobox.js,
> in the google-maps-utility-library.
> Now the problem: I've got a various numbers of markers diplaying om
> the maps (recoveries of ringed birds) an the info windows contain info
> about each recovery. clicking on a marker should open the window
> connected with the marker just as default Google Maps InfoWindows do.
> What happens now is that whichever marker I click on I get the same
> information in the InfoBox all the time and the InfoBox is at the same
> position.
> So I have two questions:
> 1. Is it possible to position the InfoBox in connection with the
> markers and if so, how do I do it?
> 2. How do I get the infobox to show the info for the marker I click
> on?
> I can tell that before I added the eventlistener 'click' all infoboxes
> appeared on the map at different positions and thus covered most of
> the map.
> The maps can be found 
> athttp://www.skof.se/fbo/arkiv/Aterfynd/min_phpsqlajax_map3.php
> In order to make it display properly you may start 
> athttp://www.skof.se/fbo/arkiv/Aterfynd/fynduttag.phpand select a bird
> species from the top left dropdown-menu. 'Tornfalk'  is a good species
> to select :-)
> Thank you in advance
> Lennart K

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.

Reply via email to