![](/img/trans.png)
[英]What should i do to fix the position of footer in my ionic 3 application?
[英]fix footer position
我正在嘗試使用代碼修復 iPad 底部的頁腳
$(window).scroll(function(){
var offsetY = window.pageYOffset;
var winHeight = $(window).height();
$('#footer').css({top: (winHeight+offsetY-60)+'px'});
});
其中 60 是頁腳的高度。 它工作正常,但在滾動時(直到未完成)頁腳的頂部 position 沒有改變,現在有什么辦法可以滾動已經開始? 這樣我就可以立即移動頁腳或在滾動時將其隱藏。
您可以通過僅使用 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.