contao-academy
12/10/2013 - 3:44 PM

Sticky Footer with jQuery

Sticky Footer with jQuery

<script type="text/javascript">
  $(document).ready(function() {
   
   var docHeight = $(window).height();
   var footerHeight = $('#footer').height();
   var footerTop = $('#footer').position().top + footerHeight;
   
   if (footerTop < docHeight) {
    $('#footer').css('margin-top', 10 + (docHeight - footerTop) + 'px');
   }
  });
 </script>