您当前的位置: 首页 > 知识百科 > 微信小程序悬浮窗弹出怎么实现?

微信小程序悬浮窗弹出怎么实现?

时间:2023-07-01 14:05 阅读数:171 人阅读 分类:知识百科

  微信小程序悬浮窗弹出怎么实现?很多的微信小程序管理员会在微信小程序界面开发微信小程序悬浮窗弹出功能,接下来小编会为大家介绍微信小程序悬浮窗弹出关注实现的全部步骤哦。

  微信小程序悬浮窗弹出怎么实现?

  微信小程序悬浮窗弹出的效果如下:

  

  微信小程序悬浮窗弹出要点一:固定底部(position:fixed)

  page {

  positgeion: relative;

  height: 100%;

  }

  /*弹窗主体*/

  .moedal-content {

  positfgion: fixed;

  botthwrom: -285px;

  left: 0;

  width: 100%;

  heiethght: 285px;

  margin-top: 5px;

  background: #fff;

  z-indhrex: 999;

  }

  微信小程序悬浮窗弹出要点二、位移小程序动画translateY

  var animation = wx.createAnimation({

  duratiohwn: 500,

  timingFunction: ease-in-out,

  });

  this.animahtion = animation;

  animahtion.translateY(-285).step();

  this.sewretData({

  animahtionData: this.animation.export(),

  maskVisual: show

  });

  position文档出处

  动画文档出处

  附上完整小程序代码:

  js代码

  cascaywrdePopup: function() {

  var animation = wx.createAnimation({

  duration: h500,

  timingFunction: ease-in-out,

  });

  this.animatioyw4n = animation;

  animatweion.translateY(-285).step();

  this.setData({

  animatieyonData: this.animation.export(),

  maskVisual: show

  });

  },

  cascadeDismiss: function () {

  this.animation.translateY(285).step();

  this.setywe4yData({

  animationData: this.animation.export(),

  maskVigwesual: hidden

  });

  }

  wxml代码

  view>

  所在地区text>

  Xtext>

  view>

  请选择text>

  view>

  黑龙江view>

  内蒙古view>

  江苏view>

  山东view>

  安徽view>

  浙江view>

  福建view>

  view>

  view>

  view>

  view>

  wxss代码

  page {

  position: relative;

  height: 100%;

  }

  /*弹窗主体*/

  .modal-content {

  position: fixed;

  bottom: -285px;

  left: 0;

  width: 100%;

  height: 285px;

  /*box-shadow: 10rpx 0 30rpx rgba(0,0,0,.9);*/

  margin-top: 5px;

  background: #fff;

  z-index: 999;

  }

  /*遮罩层*/

  .modal-mask {

  position: absolute;

  top: 0;

  left: 0;

  width: 100%;

  height: 100%;

  background: #000;

  opacity: .8;

  z-index: 99;

  }

  /*弹窗头部*/

  .modal-header {

  margin: 2px 0;

  font-size: 16px;

  color: #666;

  display: flex;

  flex-direction: row;

  justify-content: space-between;

  line-height: 30px;

  }

  /*所在地区字样*/

  .modal-title {

  text-align: center;

  width: 100%;

  }

  /*关闭按钮*/

  .modal-close {

  width: 20px;

  }

  .modal-body {

  font-size: 14px;

  }

  /*每级地区标题*/

  .viewpager-title {

  padding: 0 10px;

  color: #f03118;

  line-height: 30px;

  }

  /*分隔线*/

  .viewpager-divider {

  width: 100%;

  height: 1px;

  background: #ccc;

  }

  /*每行地址*/

  .viewpager-listview view{

  line-height: 30px;

  padding: 0 10px;

  }

  /*初始隐藏*/

  .hidden {

  display: none;

  }

  /*运行时显示*/

  .show {

  display: block;

  }

  微信小程序悬浮窗弹出怎么实现的内容已经全部介绍完毕了哦,以上的全部内容供大家参考哦,各位微信小程序管理员,赶快按照小编的方法去设置微信小程序悬浮窗弹出功能吧,请多关注微小乔。

微信小程序悬浮按钮怎么创建?

微信小程序悬浮按钮如何固定在微信小程序底部?

微信小程序悬浮层怎么实现?