解决微信浏览器web页面键盘收起页面不回弹
作者:
冬至_5b58 | 来源:发表于
2019-07-03 16:08 被阅读0次(function () {
function isWeiXinAndIos () {
let ua = '' + window.navigator.userAgent.toLowerCase()
let isWeixin = /MicroMessenger/i.test(ua)
let isIos = /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(ua)
return isWeixin && isIos
}
let myFunction
let isWXAndIos = isWeiXinAndIos()
if (isWXAndIos) {
document.body.addEventListener('focusin', () => {
clearTimeout(myFunction)
})
document.body.addEventListener('focusout', () => {
clearTimeout(myFunction)
myFunction = setTimeout(function() {
window.scrollTo({top: 0, left: 0, behavior: 'smooth'})
}, 200)
})
}
})()
本文标题:解决微信浏览器web页面键盘收起页面不回弹
本文链接:https://www.haomeiwen.com/subject/ybcchctx.html
网友评论