一个属于你的次元网络基地
 
昨日:篇  今日:篇   总帖:篇   会员:
小狼人Lv92   
微信小程序css简单公告跑马灯,不用js完整代码     

效果图

Image

wxss

/*首页跑马灯效果*/
@keyframes around {
  from {
   margin-left: 100%;
  }
  to {
   /* var接受传入的变量 */
   margin-left: var(--marqueeWidth--);
  }
 }
 
.marquee_container{
  background-color: #fff;
  height: 50rpx;
  line-height: 44rpx;
  position: relative;
  width: 100%;
  margin-top:0rpx;
}
.marquee_container:hover{
  /* 不起作用 */
  animation-play-state: paused;
}
.marquee_text{
  color:#737373;
  font-size: 28rpx;
  display: inline-block;
  white-space: nowrap;
  animation-name: around;
  animation-duration: 10s;  /*过渡时间*/
  animation-iteration-count: infinite;
  animation-timing-function:linear;
}
wxml

		<!-- 公告 -->
<view class="marquee_container" style="--marqueeWidth--:-12em">
    <view class="marquee_text">欢迎使用爱宅域影视小程序,祝您观看愉快。</view>
</view>
<!--跑马灯-->

缺点,内容过长无法显示完整


来源:scdn

 2  已被阅读了1760次  楼主 2020-08-12 16:43:10
回复列表

回复:微信小程序css简单公告跑马灯,不用js完整代码

加入官群 QQ咨询 友链展示 申请友链
粤ICP备18094291号
您的IP:44.221.45.48,2024-03-29 21:47:15,Processed in 0.13965 second(s).
免责声明: 本网不承担任何由内容提供商提供的信息所引起的争议和法律责任。
Powered by HadSky 8.0.0
已有0次打赏
(2) 分享
分享

请保存二维码或复制链接进行分享

取消