New To jQuery

Hi all,

I’m new to jQuery and was needing a way to make my footer stay on the bottom of my page in case there wasn’t enough content on the page to keep it down. I decided that since I’m using a wrapper div that my footer sits under I could just get the height of the window minus the height of my header footer and navigation.

This is what I came up with:

$(document).ready(function() {
	var pageHeight = $( document  ).height();
		$('#mainWrapper').height(pageHeight-212) ;//Set Wrapper Height When Page Loads

$(window ).resize(function() {//Set Wrapper Div's Height On Page Resize
			pageHeight = $( document  ).height();//Reset Page Height To New Page Height

Being that I hardly every touch jQuey I was wondering if there is any advice or possible issues anyone could see with this script? I’ve tested it in Chrome, Firefox and IE 11. I’m not sure if there would be any issues in other browsers as I don’t have a reliable way of testing.


I used this before in the past to do cross browser testing on every different platform and it’s free.

Thanks man. I really appreciate that site. I’m trying to learn more front end development and design. Knowing what things look like cross browser will be important.

Sponsor our Newsletter | Privacy Policy | Terms of Service