最近做个h5页面有表单交互的放到app里面,发现ios底部的弹层不会自动弹出来而安卓的会。。。
so将计就计解决它
if (/Android/.test(navigator.appVersion)) {
window.addEventListener('resize', function () {
if (document.activeElement.tagName == 'INPUT' || document.activeElement.tagName == 'TEXTAREA') {
let activeEl = document.activeElement; // 当前激活元素
window.setTimeout(function () {
activeEl.scrollIntoViewIfNeeded();
}, 0);
}
// 高度低于530就隐藏底部
const windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
const fillOrderShineCard = document.getElementById('fillOrder_shineCard');
if (fillOrderShineCard) {
if (windowHeight < 530) {
fillOrderShineCard.style.position = 'static' // 隐藏
} else {
fillOrderShineCard.style.position = 'absolute' // 显示
}
}
});
}