详解微信小程序实现跑马灯效果
今天就跟大家聊聊有关详解微信小程序实现跑马灯效果,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。
Wxml代码:
<!--跑马灯 Linyufan.com--> <view class="marquee_container" > <view class="marquee_text">一个人活着就是为了让更多的人更好的活着!</view> </view> <!--跑马灯-->
Wxss代码:
/*首页跑马灯效果*/ @keyframes around { from { margin-left: 100%; } to { /* var接受传入的变量 */ margin-left: var(--marqueeWidth--); } } .marquee_container{ background-color: #fe4655; height: 50rpx; line-height: 44rpx; position: relative; width: 100%; margin-top:0rpx; } .marquee_container:hover{ /* 不起作用 */ animation-play-state: paused; } .marquee_text{ color:#fff; font-size: 28rpx; display: inline-block; white-space: nowrap; animation-name: around; animation-duration: 10s; /*过渡时间*/ animation-iteration-count: infinite; animation-timing-function:linear; } /*首页跑马灯效果*/
看完上述内容,你们对详解微信小程序实现跑马灯效果有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注行业资讯频道,感谢大家的支持。