Skip to content

Event after content changes and loading is complete #46

@daveJay42

Description

@daveJay42

I'm trying to run code that fires after the loading is complete on an image I'm bringing in with response.js. If the image was embedded in the html traditionally the following would work...

$(".textonphoto img").one('load', function() {
    // image load function
}).each(function() {
   if(this.complete) {
      // image completely loaded.
   }
});

But this doesn't fire on img elements brought in through response.js

The issue I'm having is that firing the event using .ready or .resize (R.action) works fine, but the image might not be completely loaded. So where I'm asking for the height of the image, it might come back with zero as a result.

There's a little plugin developed to deal with this issue in a traditional image tags... http://desandro.github.io/imagesloaded/ But this wouldn't detect img's in response.js data tags that I'm using

<div
data-min-width-641="<img src='../img/issue01/world-asia.jpg'>"
data-min-width-1025="<img src='../img/issue01/world-asia-big.jpg'>">
</div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions