peol / jquery.imgloaded

Fake fork of Paul Irish's image loaded method for jQuery
48 stars 22 forks source link

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

Open JasonGross opened 13 years ago

JasonGross commented 13 years ago

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).

jefferyto commented 13 years ago

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!