ios 底部用定位 fixed。在軟件盤出來后,頁面元素被頂上去一部分,fixed定位的footer也跑到了上面去。解決方法
$("input").focus(function(){
$('.footerssss').css({
'position':'absolute'
})
})
$("input").blur(function(){
$('.footerssss').css({
'position':'fixed'
})
setTimeout(function() {
var scrollHeight = document.documentElement.scrollTop || document.body.scrollTop || 0;
window.scrollTo(0, Math.max(scrollHeight - 1, 0));
}, 300);
})
思路:
input或者textarea 在用戶獲取焦點的時候,底部定位的元素 fixed變為absolute,
在input失去焦點的時候,底部定位元素 再變成 fixed。再讓頁面滾動一下,讓頂上去的一部分元素,回來。
