Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Trigger an event when pictureFill completed #53

idflood opened this Issue · 8 comments

6 participants


Triggering a custom event at the end of the pictureFill function would have some benefits I think.

Imagine if you have a responsive slideshow with images of different height. Right now, If you add the slideshow on document ready it will have a wrong height since the images are not replaced yet. You could use some imagesLoaded plugin, but again, the images are not replaced when you call it and it will still give a wrong height.

One workaround is to create the slideshow on document load event but it's not the best solution and can have some "long" delay.

Since on my setup I have jQuery I simply added this at the end of the pictureFill function:


Then I was able to simply do something like this and it fixed my issue:

$(window).on("picturefill_complete", function(){

So, is this kind of addition possible? If it is, I could try to make a pull request : )


+1 for addition of callbacks :-)


that would be a nice feature!


I would suggest to use jQuery event namespaces: $(w).trigger("complete.picturefill");



might look something like this:


I prefer a dot instead of colon, but both would be okay



fixed my example above... the . is the offical jquery way.. thanks @ixisio


I don't think this should be done with jQuery. Keep it decoupled from jQuery.


@u982744 you 're absolutely right.
think we can close this issue, the correct approach already exists #60.


Thanks for your ideas here. We're closing this out as Picturefill moves to support the new standard markup landing in browsers. Thread here: #125

@scottjehl scottjehl closed this
@xini xini referenced this issue from a commit in xini/silverstripe-responsive-images
@xini xini Trigger event on picturefill completion, see trigger complete event (… a828a63
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.