We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
原理很简单,就是定义一个外框把页面包起来,把需要使用fixed定位的元素设置成absolute定位,然后设置外框元素的样式为overflow-y:scroll即可,下面是实例: 假设外框元素为.wrap,需要fixed定位的元素为.position:
fixed
absolute
overflow-y:scroll
.wrap
.position
<html> <body> <div class=".wrap"> <div class=".position"></div> </div> </body> </html>
html, body, .wrap { width: 100%; height: 100%; } .wrap { overflow-y: scroll; -webkit-overflow-scrolling: touch; //因为使用overflow滚动体验不如正常的页面滚动,加上这个样式以后滚动即会变得顺滑 } .position { position: absolute; }
The text was updated successfully, but these errors were encountered:
如果body下有和.wrap平级的一块dom,假设为content,高度大于屏幕高度,处于.wrap下方,你这个实现.content可能会露出吗?
body
content
.content
Sorry, something went wrong.
No branches or pull requests
原理很简单,就是定义一个外框把页面包起来,把需要使用
fixed
定位的元素设置成absolute
定位,然后设置外框元素的样式为overflow-y:scroll
即可,下面是实例:假设外框元素为
.wrap
,需要fixed
定位的元素为.position
:DOM
CSS
The text was updated successfully, but these errors were encountered: