0

When loading an iframe with a youtube clip in it, the very last file that comes in from youtube is this image:

http://i1.ytimg.com/vi/W6YOAlxT7Ls/hqdefault.jpg

I'd like to fire a function when that specific image is done loading. How can I detect this w/jquery?

I've tried this:

$('[![][1]][1]').on('load', function() { 
    // bam
});

...but it results in a reload of the same image. I don't need to fetch the image, I just need to know when it has been fetched.

Christ. Even this results in the image being re-fetched:

$.when($('[![][1]][1]').load()).then( bam() );
Glorfindel
  • 21,988
  • 13
  • 81
  • 109
user2777052
  • 157
  • 3
  • 11

1 Answers1

1

try this

$('<img src="http://i1.ytimg.com/vi/W6YOAlxT7Ls/hqdefault.jpg"/>').one('load', function () {
        //your code to fire when image has loaded 
    }).each(function () {
        if (this.complete) $(this).load();
    });
iJade
  • 23,144
  • 56
  • 154
  • 243