I need some code which continuously detects for a scrollbar. If a scrollbar is found, add an additional 50px to an iframe's height, then re-run the code again so eventually there will be no scrollbar. My current code, however, doesn't work. How would I do this in HTML/CSS/JS?
Page Code:
<script>
iframeheight()
function iframeheight() {
alert('running');
var vs = window.innerWidth > document.documentElement.clientWidth;
if vs > 0 {
document.getElementById('maincode').style.height = currentheight + "50px";
}
else {}
setTimeout(iframeheight, 1);
}
</script>
<iframe id="maincode" class="maincode" src="index2.html" frameBorder="0" border="0"
onclick="iframeheight()"></iframe>