Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google maps api v3 infowindow position in custom image

I implemented the v3 of google maps in my site. I created custom images to show points on the map.

One of the custom images is 120px X 120px size and i would like to point the arrow of infowindow in the center of this image and not on the top middle.

How can i do that?

like image 417
Nick Avatar asked Feb 29 '12 14:02

Nick


People also ask

How do you change the InfoWindow position on Google Maps?

An InfoWindow can be placed on a map at a particular position or above a marker, depending on what is specified in the options. Unless auto-pan is disabled, an InfoWindow will pan the map to make itself visible when it is opened. After constructing an InfoWindow, you must call open to display it on the map.

How do I put InfoWindow on marker?

Move an info windowAttach the info window to a new marker using the InfoWindow. open() method. Note: If you call open() without passing a marker, the InfoWindow will use the position specified upon construction through the InfoWindowOptions object literal.

How do I show multiple Infowindows on Google Maps?

We can explicitly create a reference to a specific infowindow by assigning it to a custom key to the marker object, and then later retrieving it by using that reference when the marker is clicked and the event is fired. By assigning the infowindow to a marker property, each marker can have it's own infowindow.


1 Answers

Try using the pixelOffset option in InfoWindowOptions.

    myinfo = new google.maps.InfoWindow({ 
      content: "my content",
      pixelOffset: new google.maps.Size(0, 60)
    });
    myinfo.open(map, marker);

Positive y-offset values send the InfoWindow down.

like image 109
Heitor Chang Avatar answered Sep 23 '22 00:09

Heitor Chang