Advertisement
srikat

sticky-footer.js

Sep 15th, 2014
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. jQuery(function( $ ){
  2.         $(window).load(function() {
  3.  
  4.             function stickyFooter() {
  5.                 var bodyHeight = $("body").height();
  6.                 var vwptHeight = $(window).height();
  7.                 if (vwptHeight > bodyHeight) {
  8.                     $("#footer-section").css("position","absolute").css("bottom",0);
  9.                     $("#footer-section").addClass('sticky');
  10.                 }
  11.                 else {
  12.                     $("#footer-section").css("position","static");
  13.                     $("#footer-section").removeClass('sticky');
  14.                 }
  15.             } stickyFooter();
  16.  
  17.             /*resize*/
  18.             var isIE8 = $.browser.msie && +$.browser.version === 8;
  19.             if (isIE8) {
  20.                 document.body.onresize = function () {
  21.                     stickyFooter();
  22.                 };
  23.             } else {
  24.                 $(window).resize(function () {
  25.                     stickyFooter();
  26.                 });
  27.             }
  28.  
  29.             // Orientation change
  30.             window.addEventListener("orientationchange", function() {
  31.                 stickyFooter();
  32.             });
  33.  
  34.     });
  35. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement