tnblog
首页
视频
资源
登录

小程序滚动浮窗案例

2856人阅读 2022/3/9 18:59 总访问:54120 评论:0 收藏:0 手机
分类: 原生

  onPageScroll:function(e){

    var that=this;

 

    if (this.scrollEndTimer) {

      clearTimeout(this.scrollEndTimer);

      this.scrollEndTimer =null;

      if(that.data.img_ccc.indexOf('hide')==-1){

        console.log('set img_ccc hide');

        that.setData({'img_ccc':'am_t_left_hide'});

      }

    }

 

    this.scrollEndTimer = setTimeout(function () {

        console.log('滑动结束');

        that.scrollEndTimer=setTimeout(function(){

          that.setData({'img_ccc':'am_t_left'});

        },1000);

    }, 300);

 

 

  }

 

 

 

 

.am_t_left{animation:amk_t_left 0.8s ease;animation-fill-mode:forwards;}

.am_t_left_hide{animation:amk_t_left_hide 0.3s ease; animation-fill-mode:forwards;}

@-webkit-keyframes amk_t_left {

0%{

opacity: 0;

transform: translateX(100%);

}

100%{

opacity: 1;

transform: translateX(0);

}

}

 

@-webkit-keyframes amk_t_left_hide {

0%{

opacity: 1;

}

100%{

opacity: .5;

transform: translateX(70%);

}

}

 

 

 

<navigator class="img_ccc {{img_ccc}}" wx:if="{{img_ccc}}" url=""></navigator>

 


评价
走投无路 才选择了程序员
排名
6
文章
6
粉丝
16
评论
8
{{item.articleTitle}}
{{item.blogName}} : {{item.content}}
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2024TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
欢迎加群交流技术