您好,登錄后才能下訂單哦!
第一種方法:
1、給外層div容器設(shè)置背景圖片
2、監(jiān)聽(tīng)鍵盤(pán)彈出事件,彈出時(shí)調(diào)整容器的高度以適應(yīng)背景圖片
<body onresize="windowSizeChange();">
var oglHeight = document.querySelector("body").offsetHeight;
var windowSizeChange = function() { //彈出鍵盤(pán)時(shí)調(diào)整頁(yè)面的高度,防止背景圖片被擠壓出空白區(qū)域
var tempHeight = document.querySelector("body").offsetHeight;
if(tempHeight == oglHeight) {
console.info("屏幕鍵盤(pán)隱藏");
document.getElementById('content').style.height = "100%";
} else {
console.info("鍵盤(pán)顯示");
document.getElementById('content').style.height = "390px";
}
};
第二種方法:
背景固定,使用:before
body:before {
content: "";
position: fixed;
z-index: -1;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: url(../../p_w_picpaths/10.jpg) center 0 no-repeat;
background-size: cover;
}
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。