Show infoWindow without marker?

4,528 views
Skip to first unread message

3D-kreativ

unread,
Sep 14, 2010, 4:27:05 PM9/14/10
to Google Maps JavaScript API v3
Hi, I just wonder if it's possible to show an infoWindow without a
marker? And how that is done? Thanks!

geoco...@gmail.com

unread,
Sep 14, 2010, 4:32:34 PM9/14/10
to Google Maps JavaScript API v3
On Sep 14, 1:27 pm, 3D-kreativ <p...@telia.com> wrote:
> Hi, I just wonder if it's possible to show an infoWindow without a
> marker? And how that is done? Thanks!

Have you tried the documentation? (just be sure to specify a position,
and don't give it an anchor...)

except from .open()
Optionally, an InfoWindow can be associated with an anchor. In the
core API, the only anchor is the Marker class.


http://code.google.com/apis/maps/documentation/javascript/reference.html#InfoWindow

InfoWindow(opts?:InfoWindowOptions)

Creates an info window with the given options. 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. The user can click the close button on the InfoWindow to
remove it from the map, or the developer can call close() for the same
effect.

open(map:Map|StreetViewPanorama, anchor?:MVCObject)
None
Opens this InfoWindow on the given map. Optionally, an InfoWindow can
be associated with an anchor. In the core API, the only anchor is the
Marker class. However, an anchor can be any MVCObject that exposes the
position property and optionally pixelBounds for calculating the
pixelOffset (see InfoWindowOptions).

geoco...@gmail.com

unread,
Sep 14, 2010, 4:36:03 PM9/14/10
to Google Maps JavaScript API v3
On Sep 14, 1:32 pm, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:
> On Sep 14, 1:27 pm, 3D-kreativ <p...@telia.com> wrote:
>
> > Hi, I just wonder if it's possible to show an infoWindow without a
> > marker? And how that is done? Thanks!
>
> Have you tried the documentation? (just be sure to specify a position,
> and don't give it an anchor...)

and:
http://code.google.com/apis/maps/documentation/javascript/overlays.html#InfoWindows

and:
http://code.google.com/apis/maps/documentation/javascript/examples/map-coordinates.html

-- Larry


>
> except from .open()
> Optionally, an InfoWindow can be associated with an anchor. In the
> core API, the only anchor is the Marker class.
>
> http://code.google.com/apis/maps/documentation/javascript/reference.h...

3D-kreativ

unread,
Sep 14, 2010, 4:52:11 PM9/14/10
to Google Maps JavaScript API v3
Ok, Thanks! Is there any more examples? The code looks very
complicated! Or perhaps I'm to tired.....

Preciate if you any other links with some simplier code. Thanks!

On 14 Sep, 22:36, "geocode...@gmail.com" <geocode...@gmail.com> wrote:
> On Sep 14, 1:32 pm, "geocode...@gmail.com" <geocode...@gmail.com>
> wrote:
>
> > On Sep 14, 1:27 pm, 3D-kreativ <p...@telia.com> wrote:
>
> > > Hi, I just wonder if it's possible to show an infoWindow without a
> > > marker? And how that is done? Thanks!
>
> > Have you tried the documentation? (just be sure to specify a position,
> > and don't give it an anchor...)
>
> and:http://code.google.com/apis/maps/documentation/javascript/overlays.ht...
>
> and:http://code.google.com/apis/maps/documentation/javascript/examples/ma...

geoco...@gmail.com

unread,
Sep 14, 2010, 4:54:20 PM9/14/10
to Google Maps JavaScript API v3
On Sep 14, 1:52 pm, 3D-kreativ <p...@telia.com> wrote:
> Ok, Thanks! Is there any more examples? The code looks very
> complicated! Or perhaps I'm to tired.....

Polygons are't anchors, the infowindows here are effectively on the
map (and there aren't any markers...)

http://www.geocodezip.com/v3_polygon_example_squares.html
(click on a polygon/square)

-- Larry

3D-kreativ

unread,
Sep 14, 2010, 5:03:58 PM9/14/10
to Google Maps JavaScript API v3
Nice example, but the code look very complicated! My goal was to have
an infoWindow open without any clicking when the map start. There must
be some example that is a little bit simplier?

Nathan Raley

unread,
Sep 14, 2010, 5:14:57 PM9/14/10
to google-map...@googlegroups.com
During the initialization of your page when you are done defining the map and everything trigger the infowindow opening like they did in the examples he linked you during the marker/polygon click event and you have it.

--
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.


Nathan Raley

unread,
Sep 14, 2010, 5:16:23 PM9/14/10
to google-map...@googlegroups.com
Use:
infowindow.setContent(contentString);
To set the content of the infowindow.

Use:
infowindow.setPosition(point);
To set the position of where you wish to display the inowindow.

Use:
infowindow.open(map);
To open the infowindow on your map at the position you defined above and with the content you defined before that.

geoco...@gmail.com

unread,
Sep 14, 2010, 5:38:17 PM9/14/10
to Google Maps JavaScript API v3
On Sep 14, 2:03 pm, 3D-kreativ <p...@telia.com> wrote:
> Nice example, but the code look very complicated! My goal was to have
> an infoWindow open without any clicking when the map start. There must
> be some example that is a little bit simplier?

This simple enough?
http://www.geocodezip.com/map-simple-helloworld.html

-- Larry
> > > > > pixelOffset (see InfoWindowOptions).- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages