Return to Snippet

Revision: 24649
at March 7, 2010 22:32 by jayphen


Initial Code
//footer stick
$(window).bind("load", function() { 
  
   var footerHeight = 0,
       footerTop = 0,
       $footer = $("#footer");

   positionFooter();

   function positionFooter() {
      footerHeight = $footer.outerHeight();
      footerTop = ($(window).scrollTop()+$(window).height()-footerHeight)+"px";
      if ( ($(document.body).height()+footerHeight) < $(window).height()) {
         $footer.css({
              position: "absolute",
              top: footerTop
         });
      } else {
         $footer.css({
              position: "static"
         });
      }
   };
   $(window)
    .scroll(positionFooter)
    .resize(positionFooter);
    
});

Initial URL

                                

Initial Description

                                

Initial Title
jQuery Sticky Footer

Initial Tags

                                

Initial Language
jQuery