如何使用jQuery将页脚保持在屏幕底部 [英] How to keep footer at bottom of screen using jQuery
本文介绍了如何使用jQuery将页脚保持在屏幕底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用jQuery使页脚位于屏幕底部.
How to keep footer at bottom of screen using jQuery.
我知道它在CSS中是重复的,但是如何使用jQuery?
I know its duplicate in css but how do it with jQuery?
我发现在不同尺寸的屏幕(小屏幕)或其他使用CSS的解决方案上使用不同的HTML代码的问题很多.
I found many problem in different size of screen (small screens) or different HTML code on other solutions that use CSS.
例如,此解决方案使用css,但对我不起作用:
For example this solutions use css and doesn't work for me:
请注意,我有自己的设计代码,并且新的样式或结构无法帮助我解决问题.
Please note that i have my own design code and a new style or structure can't help me to fix the problem.
推荐答案
简单易行.
只需将以下代码复制/粘贴到您的页脚或要拉伸的位置到您的身体即可.
Just copy/paste following code to your body before your footer or where you want to stretch.
<div id="js-heightControl" style="height: 0;"> </div>
<script>
$(function(){
$('#js-heightControl').css('height', $(window).height() - $('html').height() +'px');
});
</script>
这篇关于如何使用jQuery将页脚保持在屏幕底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文