Advertisement
rAthus

Set iFrame height from content

Apr 24th, 2017
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var body = document.body,
  2.     html = document.documentElement;
  3. var iframe_content_height = Math.max(body.scrollHeight,body.offsetHeight,html.clientHeight,html.scrollHeight,html.offsetHeight)+20;
  4. window.parent.document.getElementById('iframe_id').height = iframe_content_height+'px';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement