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

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -