Jquery中文网 www.jquerycn.cn
Jquery中文网 >  脚本编程  >  javascript  >  正文 始终在页面底部js代码

始终在页面底部js代码

发布时间:2017-03-23   编辑:www.jquerycn.cn
jquery中文网为您提供始终在页面底部js代码等资源,欢迎您收藏本站,我们将为您提供最新的始终在页面底部js代码资源
这是一款利用了js实现的始终在页面底部效果代码,利用js控制div一直保存在页面的底部。
提示:您可以先修改部分代码再运行

<textarea name="runcool" rows="28" cols="75" > <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>让页脚保持在未满屏页面的底部(一)</title> <meta http-equiv="content-type" content="text/html;charset=gb2312"> <style type="text/css"> *{margin:0;padding:0;} #info{background:#33CCFF;text-align:center;} #bottom{background:#FFCC00;text-align:center;width:100%;} </style> </head> <body>
top
bottom
<script language="javascript" type="text/javascript"> function test(){ var infoHeight = document.getElementById("info").scrollHeight; var bottomHeight = document.getElementById("bottom").scrollHeight; var allHeight = document.documentElement.clientHeight; var bottom = document.getElementById("bottom"); if((infoHeight bottomHeight) < allHeight){ bottom.style.position = "absolute"; bottom.style.bottom = "0"; }else{ bottom.style.position = ""; bottom.style.bottom = ""; } setTimeout(function(){test();},10); } test(); </script> </body> </html></textarea>
提示:您可以先修改部分代码再运行

您可能感兴趣的文章:
始终在页面底部js代码
js 居中漂浮广告代码
关于iphoneX 适配客户端H5页面的问题
隐藏与显示回到顶部按钮的js代码
返回顶端的js代码(纯文字版)
Javascript网页底部固定层位置代码
js 延迟加载提高网页加载速度的实现方法
js滚动条回到顶部示例代码
js未结束的字符串常量异常解决方法
返回页面顶部及去页面底部的js实现代码

[关闭]