Last active
August 29, 2015 14:11
-
-
Save svandragt/cbbd138d15f61fb71df9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function SvdSetElementFullHeight(elementId, bpad) { | |
// default | |
bpad = (typeof bpad === "undefined") ? 20 : bpad; | |
var inDesignMode = document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value; | |
if (inDesignMode == "1"){ | |
return; | |
} | |
var e = document.getElementById(elementId); | |
if (!e) { return; } | |
// viewport height - how far down the page it is - 20 pixels bpad | |
e.style.height = (window.innerHeight - e.getBoundingClientRect().top - bpad) + "px"; | |
// hide scrollbar because MS likes to put empty paragraphs into the template | |
var s4w = document.getElementById('s4-workspace'); | |
if (s4w) { s4w.style.overflow = 'hidden'; } | |
} | |
function SvdSetFullHeight() { | |
SvdSetElementFullHeight('WebPartWPQ2'); | |
} | |
// attach to load / resize | |
if (window.addEventListener) { | |
window.addEventListener('load', SvdSetFullHeight, false); | |
window.addEventListener('resize', SvdSetFullHeight, false); | |
} else { | |
window.attachEvent('onload', SvdSetFullHeight); | |
window.attachEvent('onresize', SvdSetFullHeight); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment