当前位置: 首页 > Web前端 > HTML

Vue中通过jQuery控制元素滚动到可视区才显示

时间:2023-03-28 19:15:14 HTML

methods:{/**添加动画效果*/aniCom(ele,posit,leng1,leng2){$(window).scroll(function(){letwinTop=$(window).scrollTop()$(ele).each(function(){if($(this).offset().top=winTop){$(this).css({opacity:0,[posit]:leng2,transitionDuration:'1.2s'})}})})}}mounted(){this.$nextTick(()=>{this.aniCom($('.animate'),'bottom','104px','0px')this.aniCom($('.vip'),'top','50%','70%')this.aniCom($('.text'),'bottom','54px','0')})}