在css中,可以使用visibility屬性來設置占位隱藏育勺,語法 visibility:hidden;但荤;該屬性規(guī)定元素是否可見,當值為“hidden”時涧至,表示元素是不可見的腹躁,但也會占據(jù)頁面上的空間,并對網(wǎng)頁的布局起作用南蓬。需要子級可顯示時纺非,語法visibility: visible
以uniapp中的movable-area哑了、movable-view為例
<movable-area class="movabelArea">
<movable-view class="max" direction="all" inertia="true" @click="backHome">
<image class="homeImg" src="/static/images/home.png"></image>
</movable-view>
</movable-area>
.movabelArea{
width: 100vw;
height: 100vh;
position: fixed;
z-index: 100;
visibility: hidden;
}
.max{
background-color: #1890ff;
width: 108upx;
height: 108upx;
border-radius: 50%;
text-align: center;
box-shadow: 4upx 4upx 16upx #999;
position: absolute;
bottom: 96upx;
right: 88upx;
top: auto;
left: auto;
z-index: 45;
visibility: visible;
}
.homeImg{
width: 48upx;
height: 48upx;
display: inline-block;
margin-top: 28upx;
}
效果如圖: