在给客户制作高端网站定制的时候,遇到网页导航栏随着网页滚动下滑的问题。以下是处理方法:
实现方法不需要js,只需要css样式即可。
.box{
position: relative;
width: 100%;
z-index: 999; background-color: #000000;
}
.box-active{
position: fixed;
top: 0;
}
其中最关键的样式方法是这三句:
position: relative;
position: fixed;
top: 0;
经过测试,在制作郑州微信小程序定制开发的时候,遇到网页导航栏随着网页滚动下滑的问题。同样也是采取这个方法:
position: fixed;
top: 0;