<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta charset="UTF-8">
<title>解决</title>
<script type="text/javascript" src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
<style type="text/css">
*{
margin:0;
padding: 0;
}
.fixedTop{
height: 30px;
width:100%;
background-color: red;
}
.fixedBottom{
height: 30px;
width:100%;
background-color: red;
}
.centerContent{
overflow: auto;/*让div存在滚动条*/
/*解决ios中滚动div的卡顿问题*/
-webkit-overflow-scroll:touch;
-webkit-overflow-scrolling: touch;
}
.fixedTop input,.fixedBottom input{
width: 100%;
height:30px;
}
</style>
</head>
<body>
<div class="fixedTop" alt="顶部不动的div">
<input type="text" name="" value="输入框1">
</div>
<div class="centerContent">
1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>
</div>
<div class="fixedBottom" alt="底部不动的div">
<input type="text" name="" value="输入框2">
</div>
<script type="text/javascript">
var centerContentH=window.innerHeight-$(".fixedTop").height()-$(".fixedBottom").height();//可滚动区域高度
$(".centerContent").css({"height":centerContentH});
//底部输入框操作 输入框获取焦点时,将页面滚到最底部去
$(".fixedBottom input").focus(function(){
setTimeout(function(){
$(window).scrollTop(window.innerHeight);
},500);
});
</script>
</body>
</html>