JasoN_Sy

Sticky footer

Dec 3rd, 2016
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.81 KB | None | 0 0
  1. //sticky footer 1
  2. $(document).ready(function(){
  3.     $(window).resize(function(){
  4.         var footerHeight = $('.footer').outerHeight();
  5.         var stickFooterPush = $('.push').height(footerHeight);
  6.  
  7.             $('.wrapper').css({'marginBottom':'-' + footerHeight + 'px'});
  8.             });
  9.        
  10.             $(window).resize();
  11.     });
  12.  
  13. //sticky footer 2
  14. jQuery(function($) {
  15. $(window).load(function() {
  16.   stickyFooter();
  17.  
  18.   function stickyFooter(){
  19.     var bodyHeight = $("body").height() + $("#colophon").height();
  20.     var vwptHeight = $(window).height();
  21.  
  22.     if (vwptHeight > bodyHeight) {
  23.       $("footer#colophon").css("position","absolute").css("bottom",0).css("left",0).css("right",0);
  24.     }else {
  25.       $("footer#colophon").css("position","relative");
  26.     }
  27.   }
  28.   $(window).resize(stickyFooter);
  29.   $(window).scroll(stickyFooter)
  30. });
  31. });
Advertisement
Add Comment
Please, Sign In to add comment