Guest User

Untitled

a guest
May 26th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. function adjustFrameSize() {
  2. const frame = frameElement// as HTMLIFrameElement;
  3. if (frame) {
  4. frame.width = getDocWidth() + 'px';
  5. frame.height = '0px'; // FF workaround to force scrollHeight recalculation!
  6. frame.height = getDocHeight() + 'px';
  7. }
  8. }
  9.  
  10. function getDocWidth() {
  11. return Math.max(
  12. document.body.scrollWidth, document.documentElement.scrollWidth,
  13. document.body.offsetWidth, document.documentElement.offsetWidth,
  14. document.body.clientWidth, document.documentElement.clientWidth
  15. );
  16. }
  17.  
  18. function getDocHeight() {
  19. return Math.max(
  20. document.body.scrollHeight, document.documentElement.scrollHeight,
  21. document.body.offsetHeight, document.documentElement.offsetHeight,
  22. document.body.clientHeight, document.documentElement.clientHeight
  23. );
  24. }
Add Comment
Please, Sign In to add comment