微信H5页面中软键盘收回时页面不回弹
作者:
k_zone | 来源:发表于
2019-10-14 14:31 被阅读0次问题:在微信H5中 ios12 软键盘收回时页面不回弹,导致光标位置错乱,再次点击输入框区域时无法focus
解决思路:失去焦点时滚动下页面
let ua = window.navigator.userAgent;
if (!!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) {
//$alert('ios端');
oInput.onblur = function () {
var currentPosition, timer;
var speed = 1;
timer = setInterval(function () {
currentPosition = document.documentElement.scrollTop || document.body.scrollTop;
currentPosition -= speed;
window.scrollTo(0, currentPosition); //页面向上滚动
currentPosition += speed;
window.scrollTo(0, currentPosition); //页面向下滚动
clearInterval(timer);
}, 100);
}
} else if (ua.indexOf('Android') > -1 || ua.indexOf('Adr') > -1) {
// console.log('安卓正常')
}
本文标题:微信H5页面中软键盘收回时页面不回弹
本文链接:https://www.haomeiwen.com/subject/peniyctx.html
网友评论