關於手機端input獲取焦點呼起鍵盤背景圖片擠壓解決方案
阿新 • • 發佈:2018-11-26
1、解決圖片擠壓問題
可以將背景圖片height: 100%改為min-height:100%即可
2、解決android下鍵盤不遮擋input輸入框
// 處理android 下鍵盤遮擋input let ua = window.navigator.userAgent; if(ua.indexOf('Android') > -1 || ua.indexOf('Adr') > -1){ var winHeight = $(window).height(); //獲取當前頁面高度 $(window).resize(function() { var thisHeight = $(this).height(); if (winHeight - thisHeight > 50) { $('body').css('height', winHeight + 'px'); $('.lml-phone-login').css({'bottom': '-50px'}) } else { $('body').css('height', '100%'); $('.lml-phone-login').css({'bottom': '0px'}) } }); }