On/Off
Event detection
on / off
Adds or removes a listener for a specific event on a given layer.
Parameter
Parameter
Description
Type
type
specifies which event to listen to.
String
Supported types:
"mouseup", "mousedown", "click", "dblclick", "mousemove", "mouseenter", "mouseleave, "mouseover", "mouseout", "contextmenu", "touchstart", touchend" or "touchcancel". "mouseenter" and "mouseover" events are triggered when the cursor enters a visible portion of the specified layer or map canvas from outside and vice versa for "mouseleave" and "mouseout".
layerId (Optional)
ID of a style layer. Only layer that matches the given parameter will trigger the event listener.
String
listener
A callback function that detects the event and triggers further procedures.
Function
Example(Javascript + HTML)
Last updated