sticky_footer.js 574 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
$(function() {
  var stickyFooter = function(){
    var pageHeight = $('html').height();
    var windowHeight = $(window).height();
    var footerHeight = $('footer').outerHeight();

    var totalHeight = $('footer').hasClass('fixed-bottom') ? pageHeight + footerHeight : pageHeight;


      if (windowHeight < totalHeight) {
        return $('footer').removeClass('fixed-bottom');
      } else {
        return $('footer').addClass('fixed-bottom');
      }
  };

  stickyFooter();

  $(window).resize(function() {
    console.log("resizing");
    stickyFooter();
  });
});