關於移動端底部定位問題

來源:互聯網
上載者:User

標籤:htm   支付   html   load   效果   function   mdf   absolute   螢幕高度   

移動端的頁面有些內容是需要固定在底部,一般會採用fixed,當頁面中input擷取到焦點的時候,

這時候底部的內容就會被頂上來

如果是按鈕被頂上來,有時候不會影響頁面效果,可是當底部是一些廣告或者注意事項的時候,這時候這種效果就不行了。

解決辦法,:

.mdfMessageBtn{
width:100%;
height:50px;
background-color: #ffb000;
color:#fff;
position:absolute;
bottom:0;
font-size: 16px;
}
html:
<div class="userContainer" style="position: relative; ">
  <button class="mdfMessageBtn">立即支付</button>
</div>
js:
loadBtn(".userContainer",".mdfMessageBtn");
/*按鈕定位*/
function loadBtn(boot,loat){
var height=$(window).height();
$(boot).css("min-height",height);
var uHeight=$(boot).height();
if(uHeight<=height){

   }else{
$(loat).css({"position":"relative"})
    }
};
給按鈕絕對位置,給其父級相對定位,擷取螢幕高度,讓其父級的最小高度為螢幕的高度,

關於移動端底部定位問題

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.