前端坑

web网页input框设置,点击input框弹出键盘,再收回键盘,焦点框会随页面滚动

.x-input-el {
display: block;
/*add:防止闪屏*/
-webkit-user-modify: read-write-plaintext-only
}
在css里边找到.x-input-el
把下边-webkit-user-modify: read-write-plaintext-only
这句添加上,就ok了。

H5输入框input的坑
<span style="font-size:18px;"><input type="number" id="typeBox" name="phone" required ></span>
[html] view plain copy
<span style="font-size:18px;">
</span>
[html] view plain copy
<span style="font-size:18px;">JS</span>
[html] view plain copy
<span style="font-size:18px;">
</span>
[html] view plain copy
<pre name="code" class="javascript"><span style="font-size:18px;">var bodyH = document.body.clientHeight;
var type = document.getElementById('typeBox');
var fif = document.getElementById('fip');
type.addEventListener("focus",function() {
fif.style.top = 0 + "px";
fif.style.height = bodyH + "px";
});
type.addEventListener("blur",function() {
fif.style.top = 0 + "px";
fif.style.height = bodyH + "px";
});</span>

原文地址:https://www.cnblogs.com/qq735675958/p/8477796.html