通过position: absolute模拟fixed定位
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>模拟position:fixed</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no" />
</head>
<style>
* { padding:0; margin:0;}
body{
-webkit-overflow-scrolling: touch;
overflow-scrolling: touch;
}
.full-section{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow: hidden;
}
.fixed{
position: absolute;
top: 50px;
left: 10px;
}
.content{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow: auto;
}
.item{
padding: 30px;
}
</style>
<body>
<div class="full-section">
<div class="fixed">绝对悬浮</div>
<div class="content">
<div class="item">检测滑动</div>
<div class="item">检测滑动</div>
<div class="item">检测滑动</div>
<div class="item">检测滑动</div>
<div class="item">检测滑动</div>
<div class="item">检测滑动</div>
<div class="item">检测滑动</div>
<div class="item">检测滑动</div>
<div class="item">检测滑动</div>
<div class="item">检测滑动</div>
<div class="item">检测滑动</div>
<div class="item">检测滑动</div>
</div>
</div>
</body>
</html>