Posted By

frkssk on 05/22/11


Tagged

jquery footer sticky


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

scottwatkins


jquery sticky footer


 / Published in: jQuery
 

  1. if($('body').height() < $(window).height()){
  2. $("#footer").css({position: "absolute",top:($(window).height()-$("#footer").height())+"px", width: "100%"})
  3. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: frkssk on March 4, 2012

Another

function placeFooter() { console.log('Placing footer:'); var docHeight = $(document.body).height(); var winHeight = $(window).height(); console.log('Document Body Height: ' + docHeight); console.log('Windows Height: ' + winHeight); if( docHeight < winHeight ) { console.log("Footer being moved."); $("#footer").css({position: "absolute", bottom:"0px",zIndex:"-100"}); } else { $("#footer").css({position: ""}); } }

placeFooter();

You need to login to post a comment.