function mobileType() {
var u = navigator.userAgent;
var android = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1;
var ios = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
var iphoneX = false
if (ios) {
if (screen.height == 812 ||screen.height === 896) {
iphoneX = true
} else {
}
}
return {
android,
ios,
iphoneX
}
}
function IOSInput () {
if (mobileType().ios) {
var itimer;
document.body.addEventListener('focusin', function () {
setTimeout(function () {
clearTimeout(itimer);
}, 200);
})
document.body.addEventListener('focusout', function () {
itimer = setTimeout(function () {
window.scroll(0, 0)
}, 300);
})
}
}
IOSInput()