Google position to display on custom marker

I don't use bullets in Google Maps because I want to make my own text and images on my marker, so I made this a custom marker using Overlays.

The Overlay position is not exactly like a marker, so I played around with it a bit and now it looks exactly like a marker.

Now the problem is that it doesn't open on top of the overlay, but exactly at the overlay position, I want it to be on top of it, 32px less at the top position.

Looking at the documentation it looks like the position of the infowindow is related to the object and to LatLng, so how can I move it?

Here is the code I'm using:

var marker;
marker = new CustomMarker(markerPosition, map, {}); // custom marker is a class I wrote to prototype the overlay.

google.maps.event.addListener(marker, 'click', function() {
    myInfowindow.open(map, marker);
}); 

      

Quite simple, but unfortunately the infowindow is above the marker and not on top as if I were using the marker.

+3


source to share


2 answers


Set the pixelOffset InfoWindow to the following:

From InfoWindows documentation



pixelOffset | Type: Size | The offset, in pixels, of the tip of the information window from the point on the map where the information window is located. If the InfoWindow is opened with an anchor, pixelOffset will be computed from the anchorPoint anchor property.

+3


source


I think you don't only need simple google markers

, you need more than a marker, see this RichMarker



0


source







All Articles