How do I implement a special event in jQuery?
-
29-09-2019 - |
Question
I'm using this plugin
to replace jQuery's imgload
event with one that will fire regardless of whether the image is cached.
The (minimal) documentation says to use it thus:
Usage: $(images).bind('load', function (e) { // Do stuff on load });
So, two questions. One, do I just link to the plugin into my header next to jQuery? And two, is my implementation
$('#preload img:first-child').load(activateThumb);
Equivalent to the one above (ie do I need to pass e
to the load()
function?
Solution
do I just link to the plugin into my header next to jQuery?
- Yes
Equivalent to the one above (ie do I need to pass e to the load() function?
- it's up to you - if you don't need it in your handler - no need to pass e
into it, but I think you should still use bind
function, since I don't see that plugin adding load
method to add event handler
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow