弹性布局解决ios输入框遮挡input


 <!DOCTYPE html>
<html lang="en"> <head>
<meta charset="UTF-8">
<!--禁止iphone 输入框获取焦点自动放大页面-->
<meta content="yes" name="apple-mobile-web-app-capable">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
html,
body {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
} .container {
display: flex;
flex-direction: column;
height: 100%;
font-size: 50px;
text-align: center; } .dialog-content {
flex: 1;
} .input-content {
display: flex;
margin-bottom: 20px;
} #text-content {
flex: 1;
height: 30px;
padding: 6px 8px;
border: 1px solid #ccc;
box-sizing: border-box;
} #text-btn {
height: 30px;
line-height: 30px;
border: 1px solid #ccc;
width: 50px;
}
</style>
</head> <body>
<div class="container">
<div class="dialog-content">
聊天啊
</div>
<div class="input-content">
<input id="text-content" type="text" placeholder="你输啊">
<input id="text-btn" type="button" value="发送">
</div>
</div>
<script src="//cdn.bootcss.com/jquery/2.2.3/jquery.min.js"></script>
<script>
document.getElementById("text-btn").onclick = function () {
document.getElementsByClassName("dialog-content")
}
$("#text-btn").click(() => {
var value = $("#text-content").val();
if (value && value != '')
$('.dialog-content').append(`<p>${value}</p>`); $("#text-content").val('');
});
$(".dialog-content").click(() => {
$("#text-content").blur();
});
//九宫格输入和其他输入法切换隐藏元素
setInterval(() => {
document.activeElement.scrollIntoView();
}, 100);
</script>
</body> </html>
 
上一篇:springcolud 的学习(二).SpringCloud微服务框架


下一篇:实现自己的MVC AJAX框架计划