Skip to content

Commit

Permalink
Guess what? More iframe resize tweaking
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Jan 28, 2014
1 parent 9671c2b commit 1d4a172
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions imp/js/imp.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,6 @@ var IMP_JS = {

var d = id.contentWindow.document;

id.observe('load', function(i) {
i.stopObserving('load');
this.iframeResize.bind(this, i).delay(0.1);
}.bind(this, id));

d.open();
d.write(data);
d.close();
Expand All @@ -111,18 +106,25 @@ var IMP_JS = {
}

id.show().previous().remove();

this.iframeResize(id);
},

iframeResize: function(id)
{
var lc;

if (id = $(id)) {
lc = id.contentWindow.document.lastChild;

id.setStyle({
height: 'auto'
}).setStyle({
height: id.contentWindow.document.lastChild.scrollHeight + 'px'
height: lc.scrollHeight + 'px'
});

if (lc.scrollHeight != lc.clientHeight) {
id.setStyle({ height: (lc.scrollHeight + 25) + 'px' });
}
}
},

Expand Down

0 comments on commit 1d4a172

Please sign in to comment.