-
Notifications
You must be signed in to change notification settings - Fork 88
Event
Wai Ho Leung edited this page Apr 17, 2014
·
10 revisions
Wiki ▸ API Reference ▸ Event
Utilities for handling event delegation, normalization between touch and mouse/trackpad events, custom events, and tying events to blocks.
# Event.on(elem, eventname, selector, handler[, onceOnly])
Attaches an event handler function for one or more events to the selected elements.
- elem: The elements that will have the event attached.
- eventname: A string representing the event type to listen for.
- handler: A function to execute when the event is triggered.
-
onceOnly:
true
if the event is only handled once;false
otherwise.
===
# Event.off(elem, eventname, handler)
Removes an event handler.
- elem: The elements that will have the event removed.
- eventname: A string representing the event type being removed.
- handler: The handler to be removed.
===
# Event.once(elem, eventname, selector, handler)
Registers an event handler on the event target and removes it immediately after the event is fired.
- elem: The elements that will have the event attached.
- eventname: A string representing the event type to listen for once.
- selector:
- handler:
===
# Event.trigger(elemOrSelector, eventname, data)
Executes all handlers and behaviors attached to the matched elements for the given event type.
- elemOrSelector: The elements that will have the event triggered.
- eventname: A string representing the event type to be triggered.
- data: