码迷,mamicode.com
首页 > Web开发 > 详细

HTML的footer置于页面最底部的方法

时间:2018-05-21 12:35:46      阅读:577      评论:0      收藏:0      [点我收藏+]

标签:else   ott   fixed   scroll   function   dcl   document   addclass   nbsp   

footer高度任意+js

fixed-bottom{position:fixed;bottom:0;width:100%;}

$(function(){

  $("#footer").removeClass("fixed-bottom");

  var contentHeight = document.body.scrollHeight,//网页正文的高度

    winHeight = window.innerHeight;//可视窗口高度

  if(!(contentHeight > winHeight)){

    $("#footer").addClass("fixed-bottom")

  } else{

    $("footer").removeClass("fized-bottom")

  }

})

HTML的footer置于页面最底部的方法

标签:else   ott   fixed   scroll   function   dcl   document   addclass   nbsp   

原文地址:https://www.cnblogs.com/wangpengfei8313/p/9066054.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!