当输入框失去焦点时,ios手机键盘收起,将滚动条改为0
解决方案
$("#phone").on("focusout",function(){
var ua = window.navigator.userAgent;
if (ua.indexOf('iPhone') > 0 || ua.indexOf('iPad') > 0) { //键盘收起页面空白问题
document.body.scrollTop = 0;
document.documentElement.scrollTop=0;
}
})
$("#code").on("focusout",function(){
var ua = window.navigator.userAgent;
if (ua.indexOf('iPhone') > 0 || ua.indexOf('iPad') > 0) { //键盘收起页面空白问题
document.body.scrollTop = 0;
document.documentElement.scrollTop=0;
}
})
网友评论