How do I implement a special event in jQuery?
-
29-09-2019 - |
문제
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?
해결책
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
제휴하지 않습니다 StackOverflow