13

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?

Peter O.
  • 32,158
  • 14
  • 82
  • 96
Nick
  • 201
  • 1
  • 5
  • 13

1 Answers1

42

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.

Heitor Chang
  • 6,038
  • 2
  • 45
  • 65
  • 1
    Worked like a charm! Thank you very much Heitor! – Nick Feb 29 '12 at 15:59
  • 2
    How to make the y offset dynamic? based on the height, means, allways on top of the marker – Hatim Apr 12 '18 at 13:34
  • @Hatim at any point, use `setOptions` to make dynamic changes, e.g.: `this.myInfoWindow.setOptions({ pixelOffset: new google.maps.Size(0, newHeightValue) })` – Kalnode Mar 05 '23 at 15:05