我做的吸顶,滚动之后滚动的内容和吸顶内容重叠了,怎么控制?如图:
<view class=“head_view static_head” style=‘z-index: 1;{{fixTop<scrollTop ? “position: sticky; position: -webkit-sticky; position: -moz-sticky; position: -ms-sticky; position: -o-sticky; top: 0;”: “”}}’>
</view>
onShow: function () {
let self = this;
wx.createSelectorQuery().select(’.static_head’).boundingClientRect(function (rect) {
self.setData({
fixTop: rect.top,
})
}).exec()
},
onPageScroll: function (res) {
let self = this;
let top = res.scrollTop;
self.setData({
scrollTop: top
});
}