Skip to content

Instantly share code, notes, and snippets.

@toddmotto
Created March 4, 2014 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toddmotto/9346064 to your computer and use it in GitHub Desktop.
Save toddmotto/9346064 to your computer and use it in GitHub Desktop.
Fixed heights/content JavaScript applications
(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);
@fernandoporazzi
Copy link

At line 22, what is supposed to be the "this" keyword?
Is it the window object?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment