Class Popup

L.Class powers the OOP facilities of Leaflet and is used to create almost all of the Leaflet classes documented.

Hierarchy

Index

Constructor methods

Methods

Constructor methods

constructor(options?: PopupOptions, source?: any): Popup

Instantiates a Popup object given an optional options object that describes its appearance and location and an optional object that is used to tag the popup with a reference to the source object to which it refers.

Parameters

Returns

Popup

Methods

public addTo(map: Map): Popup

Adds the popup to the map.

Parameters

Returns

Popup

public onAdd(map: Map)

Should contain code that creates DOM elements for the overlay, adds them to map panes where they should belong and puts listeners on relevant map events. Called on map.addLayer(layer).

Parameters

public onRemove(map: Map)

Should contain all clean up code that removes the overlay's elements from the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer).

Parameters

public openOn(map: Map): Popup

Adds the popup to the map and closes the previous one. The same as map.openPopup(popup).

Parameters

Returns

Popup

public setContent(html: string): Popup

Sets the HTML content of the popup.

Parameters

  • html: string

Returns

Popup

public setContent(el: HTMLElement): Popup

Sets the HTML content of the popup.

Parameters

  • el: HTMLElement

Returns

Popup

public setLatLng(latlng: LatLng): Popup

Sets the geographical point where the popup will open.

Parameters

Returns

Popup