首页 > 编程语言 >小程序可拖动按钮 movable-area

小程序可拖动按钮 movable-area

时间:2022-11-30 18:04:58浏览次数:31  
标签:right area 拖动 movable height 按钮

如果全屏拖动的话,movable-area会覆盖下层元素,所以就把拖动条放到页面右侧,内部元素大于拖动区域就不会出现需要点击事件穿透问题,缺点是只能在边上并且只能上下或者左右拖动

  <movable-area class="movable-area">
    <movable-view direction="all" style="top: 50%;">
      <view class="float-add-btn">
        <navigator url="./add/add" hover-class="none">+</navigator>
      </view>
    </movable-view>
  </movable-area>

 

/* 浮动按钮 */
.movable-area {
    width: 20rpx;
    height: 90vh;
    position: fixed;
    top: 0;
    right: 10rpx;
}

.float-add-btn {
    position: fixed;
    top: 40%;
    right: 4%;
    background-color: rgba(34, 152, 239, 0.7);
    color: #fff;
    width: 120rpx;
    height: 120rpx;
    display: flex;
    align-items: center;
    justify-content: space-around;
    border-radius: 50%;
    font-size: 3rem;
    font-weight: lighter;
    padding-bottom: 6px;
    box-sizing: border-box;
}

 

标签:right,area,拖动,movable,height,按钮
From: https://www.cnblogs.com/jqynr/p/16939279.html

相关文章