added picturefill ready & update events and jslint fixes #60

Closed
wants to merge 2 commits into
from

10 participants

@u982744

Fires picture fill ready event first time, then picture fill update event subsequent times. Also updated picturefill code to pass jslint.

@christopherdarling

any clues when this will be pulled in? would be a great feature to have...

@tjtate

bump :)

@seafarer

While this feature would be awesome, it breaks in IE8.

@4aficiona2

Really looking for this feature to be able to lazyload the given image. How is the syntax to use picturefill_ready and picturefill_update?

@nwtn

@zoo2rock if you're looking to lazyload, i have a branch at https://github.com/nwtn/picturefill/tree/resourcepriorities or https://github.com/nwtn/picturefill/tree/picturefull that takes a postpone attr to delay loading until the image is in the viewport.

@4aficiona2

@nwtn thx, I will check out your branch. So far I determine the most dominant color (serverside), attach the color as BG-color to the picturefill span and lazyload (https://github.com/tuupola/jquery_lazyload) the responsive images/picturefill images. Because of my given setup I'm interested how to listen / define the callback for picturefill. Any suggestions? Thanks.

@4aficiona2

@nwtn thx, looks great your fork!

@nwtn

@zoo2rock great, glad it was helpful for you

@michaelplant

@u982744 - Great job on your update, I am looking for a way to have a callback triggered after the images are loaded. I think this is similar to #53 in that I am trying to determine maximum height of a set of divs.

After reading through the comments it sounds like the general consensus is to handle this separately than the picturefill itself. Any updates on your pull?

@u982744

I've made it work in IE8 now. You have to use the method picturefill.bind though. This is because a workaround needs to be used to allow custom events in IE8.

eg
picturefill.bind("picturefill_ready", function () {
alert("ready now!");
});

picturefill.bind("picturefill_update", function () {
alert("updated now!");
});

@SimonHarte

Bump for merge, picturefill doesn't seem to work at all when I try to drop-in the forked version and we desperately need this.

@Wilto
Collaborator

Hm, this one is tricky. It’s an easy enough change, but would take us back out of “polyfill” territory. In the case of the native picture, both of these events—one on initially loading the source and one when a new source is swapped in—would be handled by listening for a load event on the inner img. There won’t be anything in the way of custom picture events.

We’ll talk this one over internally and get back to everyone.

@scottjehl
Owner
@scottjehl
Owner

Closing based on prior comment. Thanks!

@scottjehl scottjehl closed this Apr 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment