Under iOS If there is a fixed element at the bottom of the page when the input box triggers the keyboard, the fixed float appears in the page display always
There are a number of workarounds, but you need to change them according to actual needs
Method One, the CSS solves (the disadvantage: when has the large area INPUT element to have the sliding not to be smooth problem)
This sets the Position:absolute for the content area and sets a distance from the fixed bottom distance
. main{
Position:absolute;
Bottom:rem-calc (80px); The height of the fixed element
top:0;
left:0;
width:100%;
}
Method Two, JS solution (disadvantage: Each input focus event to be executed once)
. pos-rel {
Position:relative;;
}
<script>
$ (function () {
var Isios = (/iphone|ipad/gi). Test (navigator.appversion);//Determine if the iOS system
if (Isios) {
$ ('. Main '). On (' Focus ', ' input ', function () {
$ ('. Fixed-bottom '). addclass (' Pos-rel ');
}). On (' focusout ', ' input ', function () {
$ ('. Fixed-bottom '). Removeclass (' Pos-rel ');
});
}
});
</script>
Of course there are other solutions such as the use of iscroll.js at the beginning of the solution, and later found that in the INPUT element or the Click event Page introduced Iscroll.js will encounter a variety of pits are not recommended, of course, you can also set the fixed to absolute each time the page scrolling changes calculations, and this approach is also very resource-intensive
Combined with the above still feel that the page with input elements to avoid the use of fixed elements
Troubleshoot input and fixed issues on iOS