Instance Members

getId()

Get the marker's id.

// one marker 
marker.getId();

// markers
let ids = [];
for(let i = 0; i < markers.length; i++) {
    ids.push(markers[i].getId());
}
console.log('Ids :', ids);

setLngLat(markerId, lnglat)

Set the marker's geographical position and move it.

Required Parameter

Description

Type

markerID

The ID that created the marker.

String

lnglat

Latitude and longitude {lat, lng}

Object

const lnglat = { lat: 37.482630, lng: 126.899893};
marker.setLngLat(markerID, lnglat);

getLngLat(markerId)

Required Parameter

Description

Type

markerID

The ID that created the marker.

String

Get the marker's geographical location.

setMessage(markerId, message)

Sets the popup's content to a string of text.

Required Parameter

Description

Type

markerID

The ID that created the marker.

String

message

The message you want to show on the marker.

HTML

setZIndex(markerId, index)

Change the marker's Z-lndex.

Required Parameter

Description

Type

markerID

The ID that created the marker.

String

index

The z-index CSS property sets the z-order of a positioned element and its descendants or flex items.

Numeric

getZIndex(markerId)

Get the marker's Z-lndex.

Required Parameter

Description

Type

markerID

The ID that created the marker.

String

setOffset(markerId, offset)

Sets the offset of the marker.

Required Parameter

Description

Type

markerID

The ID that created the marker.

String

offset

Move the selected element to a specific location.

Array<numeric>

getOffset(markerId)

Get the marker's offset.

Required Parameter

Description

Type

markerID

The ID that created the marker.

String

setDraggable(markerId, bool)

Sets the draggble property and functionality of the marker.

Required Parameter

Description

Type

markerID

The ID that created the marker.

String

bool

Whether to move by clicking on the marker.

boolean

isDraggable(markerId)

Returns true if the marker can be dragged.

Required Parameter

Description

Type

markerID

The ID that created the marker.

String

setPopupOffset(markerId, offset)

Sets the Popup offset of the marker.

Required Parameter

Description

Type

markerID

The ID that created the marker.

String

offset

Move the selected element to a specific location.

Array<numeric>

getPopupOffset(markerId)

Get the marker's Popup offset.

Required Parameter

Description

Type

markerID

The ID that created the marker.

String

togglePopup()

Opens or closes the Popup instance that is bound to the Marker, depending on the current state of the Popup.

Last updated

Was this helpful?