uni-App置顶吸顶
这里要注意不能嵌套 看图
.questionbag{
position: -webkit-sticky;
position: sticky;
top: var(--window-top);
z-index: 99;
}
web同样可以实现这种效果
top: var(–window-top);其中–window-top这个方法是uni提供的css变量,在web页面可以直接写px,比如写80px他会在距离上边距80px的时候悬浮,可以尝试下
.questionbag{
position: -webkit-sticky;
position: sticky;
top: 80rpx;
z-index: 99;
}
最后的样子