Skip to content

Commit

Permalink
Delay iframe resizing to fix IE
Browse files Browse the repository at this point in the history
Might as well rate limit the same way we rate limit lazy loading
behavior also
  • Loading branch information
slusarz committed Sep 19, 2014
1 parent 5fcbf82 commit 0c889f8
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion imp/js/imp.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@

var IMP_JS = {

// iframeresize_run,
// lazyload_run,

resize_delay: 0.05,

/**
* Use DOM manipulation to un-block images.
*/
Expand Down Expand Up @@ -125,6 +128,15 @@ var IMP_JS = {
},

iframeResize: function(e, id)
{
// IE (at a minimum) needs a slight delay to size properly
if (!this.iframeresize_run) {
this.iframeresize_run = true;
this.iframeResizeRun.bind(this, e, id).delay(this.resize_delay);
}
},

iframeResizeRun: function(e, id)
{
var body, h, html;

Expand Down Expand Up @@ -155,13 +167,16 @@ var IMP_JS = {

this.iframeImgLazyLoad(id);
}

this.iframeresize_run = false;
},

iframeImgLazyLoad: function(iframe)
{
if (!this.lazyload_run) {
this.lazyload_run = true;
this.iframeImgLazyLoadRun.bind(this, iframe).delay(0.1);
this.iframeImgLazyLoadRun.bind(this, iframe)
.delay(this.resize_delay);
}
},

Expand Down

0 comments on commit 0c889f8

Please sign in to comment.