zoukankan      html  css  js  c++  java
  • 原生小程序底部弹出层动画过渡

    1.wxml

    <view class="my-dialog" catchtouchmove="true">//catchtouchmove阻止冒泡,防止遮罩层底部滑动

      <view class="my-mask" bindtap="confirmDialog" hidden="{{!showDialog}}" ></view>
      <view class="my-container" animation="{{animatheightadd}}"></view>
    </view>
     
    2.wxss
    .my-dialog {
      opacity: 1;
    }

    .my-dialog .my-mask {
      position: fixed;
      top: 0;
      left: 0;
       100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.6);
      z-index: 1000;
    }

    .my-dialog .my-container {
      position: fixed;
       90%;
      padding: 30rpx 5%;
      bottom: 0;
      left: 0;
      background:#fff;
      overflow: hidden;
      z-index: 5000;
    }
     
    3.js
    data:{
      animatheightadd:{},
      showDialog:false
    }
    onReady: function () {
          //定义动画
      this.animation = wx.createAnimation({
        duration: 1000,
        timingFunction: 'ease'
      })
      //先隐藏内容
      this.animation.translateY(331).step()
      this.setData({
        animatheightadd: this.animation.export()
      })
    },
    refuse:function(){
      //显示底部弹出层
      this.animation.translateY(0).step()
      this.setData({
        animatheightadd:this.animation.export()
      })
      this.setData({
        showDialog: true
      })
    }
    confirmDialog: function (e) {
      //隐藏底部
      this.setData({
        showDialog: false
      })
      this.animation.translateY(331).step()
      this.setData({
        animatheightadd:this.animation.export() //导出动画api , 页面执行动画
      });
    },
     
     
  • 相关阅读:
    C#窗体操作的小技巧
    C#操作Xml
    Path类对路径字符串的操作
    Google Maps 基础
    C#时间操作总结
    根据地理坐标计算瓦片行列号
    使用VBA宏批量修改表格
    检测到在集成的托管管道模式下不适用的ASP.NET设置的解决方法
    Asp.net实现URL重写
    VS2013利用ajax访问不了json文件——VS2013配置webconfig识别json文件
  • 原文地址:https://www.cnblogs.com/mcll/p/11659981.html
Copyright © 2011-2022 走看看