Skip to content

Marker

Marker is used to display clickable/draggable icons on the map. Extends Layer.

Usage example

js
new Marker([50.5, 30.5]).addTo(map);

Draggable marker options

OptionTypeDefaultDescription
draggableBooleanfalseWhether the marker is draggable with pointer or not.
autoPanBooleanfalseWhether to pan the map when dragging this marker near its edge or not.
autoPanPaddingPointPoint(50,Distance (in pixels to the left/right and to the top/bottom) of the
autoPanSpeedNumber10Number of pixels the map should pan by.

Options

OptionTypeDefaultDescription
iconIcon*Icon instance to use for rendering the marker.
keyboardBooleantrueWhether the marker can be tabbed to with a keyboard and clicked by pressing enter.
titleString''Text for the browser tooltip that appear on marker hover (no tooltip by default).
altString'Marker'Text for the alt attribute of the icon image.
zIndexOffsetNumber0By default, marker images zIndex is set automatically based on its latitude. Use this option if you want to put the marker on top of all others (or below), specifying a high value like 1000 (or high negative value, respectively).
opacityNumber1.0The opacity of the marker.
riseOnHoverBooleanfalseIf true, the marker will get on top of others when you hover the pointer over it.
riseOffsetNumber250The z-index offset used for the riseOnHover feature.
paneString'markerPane'Map pane where the markers icon will be added.
shadowPaneString'shadowPane'Map pane where the markers shadow will be added.
bubblingPointerEventsBooleanfalseWhen true, a pointer event on this marker will trigger the same event on the map
autoPanOnFocusBooleantrueWhen true, the map will pan whenever the marker is focused (via

Events

EventDataDescription
moveFired when the marker is moved via setLatLng or by dragging. Old and new coordinates are included in event arguments as oldLatLng, latlng.