微信小程序animation底部弹窗动画css代码
作者:xlnxin发布时间:2025-02-26分类:编程知识浏览:13
导读:<button catchtap='clickPup'>点击底部动画弹窗</button><!-- 底部弹...
<button catchtap='clickPup'>点击底部动画弹窗</button> <!-- 底部弹窗动画的内容 --> <view class='pupContent {{click? "showContent": "hideContent"}} {{option? "open": "close"}}' hover-stop-propagation='true'> <view class='pupContent-top'>测试一下</view> </view> <!-- 固定的背景 --> <view class='pupContentBG {{click?"showBG":"hideBG"}} {{option?"openBG":"closeBG"}}' catchtap='clickPup'> </view>
wxss代码
.pupContentBG { width: 100vw; height: 100vh; position: fixed; top: 0; } .pupContent { width: 100%; background: pink; position: absolute; bottom: 0; box-shadow: 0 0 10rpx #333; height: 0; z-index: 999; } /* 设置显示的背景 */ .showBG { display: block; } .hideBG { display: none; } /* 弹出或关闭动画来动态设置内容高度 */ @keyframes slideBGtUp { from { background: transparent; } to { background: rgba(0, 0, 0, 0.1); } } @keyframes slideBGDown { from { background: rgba(0, 0, 0, 0.1); } to { background: transparent; } } /* 显示或关闭内容时动画 */ .openBG { animation: slideBGtUp 0.5s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } .closeBG { animation: slideBGDown 0.5s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } /* 设置显示内容 */ .showContent { display: block; } .hideContent { display: none; } /* 弹出或关闭动画来动态设置内容高度 */ @keyframes slideContentUp { from { height: 0; } to { height: 800rpx; } } @keyframes slideContentDown { from { height: 800rpx; } to { height: 0; } } /* 显示或关闭内容时动画 */ .open { animation: slideContentUp 0.5s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } .close { animation: slideContentDown 0.5s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ }
第二种css
/* 弹出或关闭动画来动态设置内容高度 */ @keyframes slideContentUp { from { transform: translateY(100%); /*设置为正数则底部弹出来,负数则相反*/ } to { transform: translateY(0%); } } @keyframes slideContentDown { from { transform: translateY(0%); } to { transform: translateY(100%); } }
- 上一篇:微信小程序自定义底部、顶部、中间、左边及右边弹窗
- 下一篇:已经是最后一篇了
相关推荐
- 微信小程序自定义底部、顶部、中间、左边及右边弹窗
- 小程序component使用app.wxss
- 微信小程序引用 vant weapp calendar选择器
- 微信小程序表单各种组件源代码
- 小程序img_sec_check图片检测出行"errcode":47001错误解决方法
- 双击excel打开不显示任何内容,只能在excel里面打开文件解决方法
- 小程序saveVideoToPhotosAlbum安卓手机可以下载MP4苹果手机不能下载解决方法
- 小程序逆向错误之 typeof3 is not a function
- 小程序e.target.dataset和e.currentTarget.dataset区别
- EXCEL双击不能直接打开EXCEL文件解决办法
- 编程知识排行
- 最近发表