jquery-first-event
Execute your event handler before others.
Installation
npm install --save jquery-first-event
Example
// After a click on `<p>` it will print:// quz// foo// bar
Use cases
Preventing stop propagation
It is not unusual to get, on a large code base, an event listener that is stopping propagation. With first-event you can run you event handler before the one that stops the event propagation.
// Will print:// foo // Work-around with `first-event`// ------------------------------ // Will print:// bar// foo
Delay event
On Safari iOS, the browser needs some time to render CSS animations. So, if you want to show a CSS animation between pages, you need to give the browser that time to, only then, change the URL.
Methods
firstOn
(available on jQuery >= 1.7)firstLive
(available on jQuery < 1.9)firstBind
firstDelegate
firstOne
All methods implements the same jQuery counterparts API.
Support
All the below jQuery versions:
- 1.4
- 1.5
- 1.6
- 1.7
- 1.8
- 1.9
- 1.10
- 1.11
- 2.0
- 2.1
Credits
- Icon created by 0gust1 from the Noun Project