DomEvent

Utility functions to work with the DOM events, used by Leaflet internally.

Functions

Function Returns Description
on(<HTMLElement> el, <String> types, <Function> fn, <Object> context?) this Adds a listener function (fn) to a particular DOM event type of the element el. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
on(<HTMLElement> el, <Object> eventMap, <Object> context?) this Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
off(<HTMLElement> el, <String> types, <Function> fn, <Object> context?) this Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular DOM event from the element. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
off(<HTMLElement> el, <Object> eventMap, <Object> context?) this Removes a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
stopPropagation(<DOMEvent> ev) this Stop the given event from propagation to parent elements. Used inside the listener functions:
L.DomEvent.on(div, 'click', function (ev) {
    L.DomEvent.stopPropagation(ev);
});
disableScrollPropagation(<HTMLElement> el) this Adds stopPropagation to the element's 'mousewheel' events (plus browser variants).
disableClickPropagation(<HTMLElement> el) this Adds stopPropagation to the element's 'click', 'doubleclick', 'mousedown' and 'touchstart' events (plus browser variants).
preventDefault(<DOMEvent> ev) this Prevents the default action of the DOM Event ev from happening (such as following a link in the href of the a element, or doing a POST request with page reload when a <form> is submitted). Use it inside listener functions.
stop(ev) this Does stopPropagation and preventDefault at the same time.
getMousePosition(<DOMEvent> ev, <HTMLElement> container?) Point Gets normalized mouse position from a DOM event relative to the container or to the whole page if not specified.
getWheelDelta(<DOMEvent> ev) Number Gets normalized wheel delta from a mousewheel DOM event, in vertical pixels scrolled (negative if scrolling down). Events from pointing devices without precise scrolling are mapped to a best guess of 60 pixels.
addListener() this Alias to L.DomEvent.on
removeListener() this Alias to L.DomEvent.off
v0.1.2239
Props L.Wrld.Prop
Themes L.Wrld.themes
UI Layers L.Marker L.Popup
Heatmaps L.Wrld.Heatmap
Events Event objects
Services (Optional) WrldPoiApi