jQuery Sticky Footer

A sticky footer implementation that avoids modifying your HTML structure, using only jQuery and one line of CSS.
$(window).resize(function() {
    if ($('body').height() < $(window).height()) {
        $('#footer').addClass('fixed');
    }
    else {
        $('#footer').removeClass('fixed');
    }
}).resize();
/* this goes in your CSS */
#footer.fixed { position: fixed; bottom: 0; width: 100%; }
Posted by
Snippet Viewed 1967 times.

Share your jQuery code snippets:

  • Get some recognition & link back to your site.

 

Submit | Browse

Most Recent jquery snippets

Most Viewed