footer - jQuery produces 'undefined' error - am I going mad? -


i trying dynamically position footer bottom of user's screen using jquery. i'm pretty sure code correct i'm getting 'undefined' message in firequery.

can see i'm going wrong?

$(document).ready(function(){  $(function(){     // define min height content based on window size     var wrapper = $(window).height();     var content = $("#content_wrapper");     var header = $("#header_wrapper").height();     var footer = $("#footer_wrapper").height();     // content height     contentheight = wrapper - header - footer - 279;     $(content).css("min-height", contentheight + "px"); });  }); 

see fiddle here

check fiddle: http://jsfiddle.net/gt3ex/5/

a few things:

i don't think fiddle has jquery selected under frameworks & extensions (the drop-down on left)

you have double nested document ready call unecessarily. this:

$(document).ready(function(){ … }); 

is equivalent this:

$(function(){   … }); 

this, redundant:

$(document).ready(function(){      $(function(){     …     }); }); 

you don't need wrap content in $() since it's wrapped when set var content = $("#content_wrapper"); — remind use optional convention var $content = $("#content_wrapper"); know variables jquery objects.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -