OpenLayers.Popup - OpenLayers

# OpenLayers.Popup

A popup is a small div that can opened and closed on the map. Typically opened in response to clicking on a marker. See OpenLayers.Marker. Popup’s don’t require their own layer and are added the the map using the OpenLayers.Map.addPopup method.

#### Example

>     popup = new OpenLayers.Popup("chicken",
>                        new OpenLayers.LonLat(5,40),
>                        new OpenLayers.Size(200,200),
>                        "example popup",
>                        true);

>     map.addPopup(popup);

Summary

OpenLayers.Popup | A popup is a small div that can opened and closed on the map.
Properties |
autoSize | {Boolean} Resize the popup to auto-fit the contents.
minSize | {OpenLayers.Size} Minimum size allowed for the popup’s contents.
maxSize | {OpenLayers.Size} Maximum size allowed for the popup’s contents.
panMapIfOutOfView | {Boolean} When drawn, pan map such that the entire popup is visible in the current viewport (if necessary).
keepInMap | {Boolean} If panMapIfOutOfView is false, and this property is true, contrain the popup such that it always fits in the available map space.
closeOnMove | {Boolean} When map pans, close the popup.
Constructor |
OpenLayers.Popup | Create a popup.
Functions |
updateSize | Auto size the popup so that it precisely fits its contents (as determined by this.contentDiv.innerHTML).
getSafeContentSize |

### Properties

### autoSize

{Boolean} Resize the popup to auto-fit the contents. Default is false.

### minSize

{OpenLayers.Size} Minimum size allowed for the popup’s contents.

### maxSize

{OpenLayers.Size} Maximum size allowed for the popup’s contents.

### panMapIfOutOfView

{Boolean} When drawn, pan map such that the entire popup is visible in the current viewport (if necessary). Default is false.

### keepInMap

{Boolean} If panMapIfOutOfView is false, and this property is true, contrain the popup such that it always fits in the available map space. By default, this is not set on the base class. If you are creating popups that are near map edges and not allowing pannning, and especially if you have a popup which has a fixedRelativePosition, setting this to false may be a smart thing to do. Subclasses may want to override this setting.

Default is false.

### closeOnMove

{Boolean} When map pans, close the popup. Default is false.

### Constructor

### OpenLayers.Popup

Create a popup.

#### Parameters

id | {String} a unqiue identifier for this popup. If null is passed an identifier will be automatically generated.
lonlat | {OpenLayers.LonLat} The position on the map the popup will be shown.
contentSize | {OpenLayers.Size} The size of the content.
contentHTML | {String} An HTML string to display inside the popup.
closeBox | {Boolean} Whether to display a close box inside the popup.
closeBoxCallback | {Function} Function to be called on closeBox click.

### Functions

### updateSize

> updateSize: function()

Auto size the popup so that it precisely fits its contents (as determined by this.contentDiv.innerHTML). Popup size will, of course, be limited by the available space on the current map

### getSafeContentSize

> getSafeContentSize: function( | size | )

#### Parameters

size | {OpenLayers.Size} Desired size to make the popup.

#### Returns

{OpenLayers.Size} A size to make the popup which is neither smaller than the specified minimum size, nor bigger than the maximum size (which is calculated relative to the size of the viewport).

Instances of this class represent a width/height pair

> updateSize: function()

Auto size the popup so that it precisely fits its contents (as determined by this.contentDiv.innerHTML).

> getSafeContentSize: function( | size | )

Instances of OpenLayers.Marker are a combination of a OpenLayers.LonLat and an OpenLayers.Icon.

> addPopup: function( | popup,
> | exclusive | )

This class represents a longitude and latitude pair
Close