InfoWindow doesn't appear with pixelOffset?

2,988 views
Skip to first unread message

Dougx

unread,
Sep 25, 2010, 11:52:30 PM9/25/10
to Google Maps JavaScript API v3
Hi,

I'm having some trouble with the maps api; specifically, I can't get
my InfoWindows to appear correctly.

This is the code I'm using presently:

google.maps.event.addListener(marker, 'mousedown', function()
{
var content = "Hello World";
var info = new google.maps.InfoWindow({
'content' : content,
'position' : pos
});
info.open(map);
info.setZIndex(10);
});

That works perfectly, but the info window is appearing bound to the
bottom of the marker, which looks bad; I want it to appear above the
marker.

So, I've tried a couple of variations like:

info.open(marker);

and:

var info = new google.maps.InfoWindow({
'content' : content,
'position' : pos,
'pixelOffset' : 10
});

and:

var info = new google.maps.InfoWindow({
'content' : content,
'position' : pos,
'pixelOffset' : new google.maps.Size(10,0)
});

...but, in all of the above cases, my InfoWindow simply never shows
up.

To be clear; it _does_ show up with the default options; but that's
all.

Anyone know what I might be doing wrong here?

cheers,
Doug.

Luke Mahé

unread,
Sep 26, 2010, 5:21:05 PM9/26/10
to google-map...@googlegroups.com
Hey Doug,

Have you tried:
info.open(map, marker);

The infowindow open function takes a optional second paramater which defines the anchor, you can read more on the reference: http://code.google.com/apis/maps/documentation/javascript/reference.html#InfoWindow

-- Luke



--
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 google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.


Dougx

unread,
Sep 27, 2010, 12:29:44 AM9/27/10
to Google Maps JavaScript API v3
Oh wow, I completely missed that in the docs.
That worked for me yeah. :)

thanks.

On Sep 27, 5:21 am, Luke Mahé <lu...@google.com> wrote:
> Hey Doug,
>
> Have you tried:
> info.open(map, marker);
>
> The infowindow open function takes a optional second paramater which defines
> the anchor, you can read more on the reference:http://code.google.com/apis/maps/documentation/javascript/reference.h...
>
> -- Luke
> > google-maps-js-a...@googlegroups.com<google-maps-js-api-v3%2Bunsu...@googlegroups.com>
> > .
Reply all
Reply to author
Forward
0 new messages