手机网页fixed定位抖动

来源:互联网 发布:广州哪里有淘宝培训 编辑:程序博客网 时间:2024/04/29 10:34

通过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>

0 0
原创粉丝点击