position的所有属性
sticky 粘性定位
// .jsx
export default function (props){
return (
<div className='wrap'>
<div className='nav-wrap'>
nav-sticky
</div>
<div style={{height:'100vh'}}></div>
</div>
)
}
// .css
.wrap{
height:30vh;
overflow-y: scroll;
}
.nav-wrap{
position: sticky;
top: 0;
left: 0;
}