Skip to content

Commit

Permalink
make window resizing in IE8 work
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Torfs committed Sep 19, 2014
1 parent 30e05ca commit d3621b3
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/picturefill.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,18 +552,23 @@
return;
}
}, 250 );
if ( w.addEventListener ) {

function checkResize() {
var resizeThrottle;
w.addEventListener( "resize", function() {
if (!w._picturefillWorking) {
w._picturefillWorking = true;
w.clearTimeout( resizeThrottle );
resizeThrottle = w.setTimeout( function() {
picturefill({ reevaluate: true });
w._picturefillWorking = false;
}, 60 );
}
}, false );
if (!w._picturefillWorking) {
w._picturefillWorking = true;
w.clearTimeout( resizeThrottle );
resizeThrottle = w.setTimeout( function() {
picturefill({ reevaluate: true });
w._picturefillWorking = false;
}, 60 );
}
}

if ( w.addEventListener ) {
w.addEventListener( "resize", checkResize, false );
} else if ( w.attachEvent ) {
w.attachEvent( "onresize", checkResize );
}
}

Expand Down

0 comments on commit d3621b3

Please sign in to comment.