[英]fix footer position
I am trying to fix footer at bottom in iPad using the code我正在尝试使用代码修复 iPad 底部的页脚
$(window).scroll(function(){
var offsetY = window.pageYOffset;
var winHeight = $(window).height();
$('#footer').css({top: (winHeight+offsetY-60)+'px'});
});
where 60 is the height of footer.其中 60 是页脚的高度。 Its working fine but while scrolling (untill not finished) the footer's top position does not change, is there any way I can now that scroll has started?
它工作正常,但在滚动时(直到未完成)页脚的顶部 position 没有改变,现在有什么办法可以滚动已经开始? so that I can move the footer immediately or hide it while scrolling.
这样我就可以立即移动页脚或在滚动时将其隐藏。
you can do this by using only CSS don't use jQuery for that您可以通过仅使用 CSS 来做到这一点,不要为此使用 jQuery
#footer{
position:fixed;
left:0px;
bottom:0px;
height:20px;
width:100%;
background:#999;
}
/* For ie 6*/
* html #footer{
position:absolute;
top:expression((0-(footer.offsetHeight)+(document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight)+(ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop))+'px');
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.