JasoN_Sy icon

Sticky footer

JasoN_Sy | PRO | 12/03/16 10:05:17 AM UTC | 0 ⭐ | 159 👁️ | Never ⏰ | []
jQuery |

810 B

|

None

|

0 👍

/

0 👎

//sticky footer 1
$(document).ready(function(){
    $(window).resize(function(){
        var footerHeight = $('.footer').outerHeight();
        var stickFooterPush = $('.push').height(footerHeight);
 
            $('.wrapper').css({'marginBottom':'-' + footerHeight + 'px'});
            });
        
            $(window).resize();
    });
 
//sticky footer 2
jQuery(function($) {
$(window).load(function() {
  stickyFooter();
 
  function stickyFooter(){
    var bodyHeight = $("body").height() + $("#colophon").height();
    var vwptHeight = $(window).height();
 
    if (vwptHeight > bodyHeight) {
      $("footer#colophon").css("position","absolute").css("bottom",0).css("left",0).css("right",0);
    }else {
      $("footer#colophon").css("position","relative");
    }
  }
  $(window).resize(stickyFooter);
  $(window).scroll(stickyFooter)
});
});

Comments