当页面内容不够的时候,如何让footer一直固定底部显示

 

<script type="text/javascript">

// 处理页面高度过矮时底部出现空白问题

window.onload = function(){

//待页面所有图片加载完毕后再执行

jQuery(".footer").css({'display':'block'});

if (document.body.clientHeight < window.innerHeight){

jQuery(".footer").css({'position':'fixed','bottom':'0','width':'100%'});

}

controllFooter();

};

function controllFooter(){

if ($(window).height() < $(document).height()){

$(".footer").css('position','static');

}else{

$(".footer").css({'position':'fixed','bottom':'0px'});

}

}

</script>

 

 





posted @ 2017-02-27 16:49  从你的世界路过  阅读(2522)  评论(0编辑  收藏  举报