频道栏目
首页 > 资讯 > 微信小程序 > 正文

微信小程序商品筛选,侧方弹出动画选择页面教程

19-02-12        来源:[db:作者]  
收藏   我要投稿

微信小程序商品筛选,侧方弹出动画选择页面,在一点点的零碎的时间里面写出来的代码,和前两篇效果结合出来的。点击按钮的同时,要实现这两个功能的叠加。


  1. 小程序动画animation向左移动效果。
  2. 小程序点击按钮出现和隐藏遮罩层。

效果是这样的:

demo是这样的:


  1. .isRuleShow {
  2. display: block;
  3. }
  4.  
  5. .isRuleHide {
  6. display: none;
  7. }
  8. .float {
  9. height: 100%;
  10. width: 100%;
  11. position: fixed;
  12. background-color: rgba(0, 0, 0, 0.5);
  13. z-index: 2;
  14. top: 0;
  15. left: 0;
  16. /* margin-top:80rpx; */
  17. }
  18. .iconuse {
  19. margin-left: 11rpx;
  20. }
  21.  
  22. .iconprice {
  23. margin-left: 11rpx;
  24. }
  25.  
  26. .animation-element {
  27. width: 580rpx;
  28. height: 1175rpx;
  29. background-color: #ffffff;
  30. border: 1px solid #f3f0f0;
  31. position: absolute;
  32. right: -572rpx;
  33. }
  34. .useage {
  35. height: 40rpx;
  36. }
  37.  
  38. .useage li {
  39. width: 177rpx;
  40. margin: 12rpx 7rpx;
  41. height: 70rpx;
  42. line-height: 70rpx;
  43. display: inline-block;
  44. text-align: center;
  45. border: 1px solid #f3f0f0;
  46. border-radius: 15rpx;
  47. font-size: 30rpx;
  48. }
  49.  
  50. .buttom{
  51. position: fixed;
  52. bottom: 0;
  53. }
  54. .animation-reset{
  55. float: left;
  56. line-height: 2;
  57. width: 260rpx;
  58. margin: 15rpx 12rpx;
  59. border: 1px solid #f3f0f0;
  60. text-align: center;
  61. }
  62. .animation-button{
  63. float: left;
  64. line-height: 2;
  65. width: 260rpx;
  66. margin: 15rpx 12rpx;
  67. border: 1px solid #f3f0f0;
  68. text-align: center;
  69. }

js

 

  1. Page({
  2. onReady: function () {
  3. this.animation = wx.createAnimation()
  4. },
  5. translate: function () {
  6. this.setData({
  7. isRuleTrue: true
  8. })
  9. this.animation.translate(-245, 0).step()
  10. this.setData({ animation: this.animation.export() })
  11. },
  12.  
  13. success: function () {
  14. this.setData({
  15. isRuleTrue: false
  16. })
  17. this.animation.translate(0, 0).step()
  18. this.setData({ animation: this.animation.export() })
  19. },
  20. tryDriver: function () {
  21. this.setData({
  22. background: "#89dcf8"
  23. })
  24. }
  25. })

ok完成了,今天再说一点,有人问我关于技术博客日更的事情,一来是参加了简书的日更活动,不想断开,二来是一路走来,能看见自己每天学习到的知识点和解决的问题,所以才会感到很充实,不会觉得自己每天在空空度日。如果你也想坚持一件事情,可以私聊我,我们相互监督,互相帮助,让自己变得更好。

相关TAG标签
上一篇:page级别的骚操作之禁用页面滚动问题详解
下一篇:Mysql主从同步-概念和原理介绍
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站