Created
March 4, 2014 13:00
-
-
Save toddmotto/9346064 to your computer and use it in GitHub Desktop.
Fixed heights/content JavaScript applications
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 (root, document, undefined) { | |
var $$ = function () { | |
return document.querySelectorAll(arguments[0]); | |
}; | |
var header = $$('.header')[0]; | |
var headerHeight = header.offsetHeight; | |
var content = $$('.main')[0]; | |
var sidebar = $$('.sidebar')[0]; | |
var resizeContent = function () { | |
var height = Math.max(document.documentElement['clientHeight'], document.body['scrollHeight'], document.documentElement['scrollHeight'], document.body['offsetHeight'], document.documentElement['offsetHeight']); | |
content.style.height = (height - 45) + 'px'; | |
sidebar.style.height = (height - 45) + 'px'; | |
}; | |
resizeContent(); | |
root.addEventListener('resize', resizeContent); | |
})(this, document); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
At line 22, what is supposed to be the "this" keyword?
Is it the window object?