本文作者:秀杰,来自

要点一:固定底部(position:fixed)
-
page {
-
position: relative;
-
height: 100%;
-
}
-
-
/*弹窗主体*/
-
.modal-content {
-
position: fixed;
-
bottom: -285px;
-
left: 0;
-
width: 100%;
-
height: 285px;
-
margin-top: 5px;
-
background: #fff;
-
z-index: 999;
-
}
要点二、位移动画translateY
-
var animation = wx.createAnimation({
-
duration: 500,
-
timingFunction: 'ease-in-out',
-
});
-
this.animation = animation;
-
animation.translateY(-285).step();
-
this.setData({
-
animationData: this.animation.export(),
-
maskVisual: 'show'
-
});
-
-
<view animation="{{animationData}}" class="modal-content">
position文档出处
动画文档出处
附上完整代码:
js代码
-
cascadePopup: function() {
-
var animation = wx.createAnimation({
-
duration: 500,
-
timingFunction: 'ease-in-out',
-
});
-
this.animation = animation;
-
animation.translateY(-285).step();
-
this.setData({
-
animationData: this.animation.export(),
-
maskVisual: 'show'
|
|