绿色添加按钮用绝对定位,为什么会随滚动条加载更多页面而变化位置?后面再加载更多数据也不会变化位置了,这个高度我是用屏幕高度来设置的,为啥还会变化?
<template name=“addButton”>
<navigator class=“addButton” style=“position:absolute;z-index: 999; top:{{addButtonTop}}; left:80%;opacity:1; background-color:#34b60d; color:rgb(255,255,255);height:107.5rpx; width:107.5rpx; border-radius: 50%;transform: translate(0, -50%); line-height: 107.5rpx; font-size:60.46875rpx; text-align: center;” url="{{router}}" hover-class=“navigator-hover”>+</navigator>
</template>
<template is=“addButton” data="{{router:’/pages/pageAddKaiguan/pageAddKaiguan?currentshebei=’+currentShebei,addButtonTop:addButtonTop}}"></template>
.addButton{
position:absolute;
z-index: 999;
top:90%;
left:80%;
opacity:1;
background-color:#34b60d;
color:rgb(255,255,255);
height:107.5rpx;
width:107.5rpx;
border-radius: 50%;
transform: translate(0, -50%);
line-height: 107.5rpx;
font-size:60.46875rpx;
text-align: center;
}
onLaunch: function () {
wx.getSystemInfo({
success: function(res) {
var kScreenW=res.windowWidth/375;
var kScreenH=res.windowHeight/603;
wx.setStorageSync(‘kScreenW’, kScreenW);
wx.setStorageSync(‘kScreenH’, kScreenH);
},
})
}
pageScrollFunc: function (compid, curpage) {
currentPage.setData({
“addButtonTop”: wx.getStorageSync(‘kScreenH’)*604 - 45 + “px”
});
}
在onLaunch里获取屏幕高度保存本地,滚动条绑定向下滚动事件到pageScrollFunc,为什么位置还是没有固定住???