jquery.imgloaded icon indicating copy to clipboard operation
jquery.imgloaded copied to clipboard

Load event fires twice, or not at all, in some cases

Open JasonGross opened this issue 14 years ago • 1 comments

In some browsers (Chrome, and I think Firefox), code like

$('<img>')
    .attr('src', 'http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif')
    .load(function () {
        alert(0);
    });

fires fine without the imgloaded patch, but does not fire with it.

Code like

$('<img>')
    .attr('src', 'http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif')
    .load(function () {
        $('<img>')
            .attr('src', 'http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif')
            .load(function () {
                alert(0);
            });
    });

fires fine in Chrome and Firefox without the patch, but the inner load function does not fire in IE (because the image is cached), and neither load function fires with the patch (at least in chrome).

JasonGross avatar Jan 03 '11 04:01 JasonGross

I have an experimental fork of this plugin at https://github.com/jefferyto/jquery.imgloaded/tree/pi . Can you give it a try? I'd like to get some feedback before submitting a pull request. Thanks!

jefferyto avatar Feb 01 '11 08:02 jefferyto