微信小程序左右滚动公告栏效果

Posted caoyuna

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了微信小程序左右滚动公告栏效果相关的知识,希望对你有一定的参考价值。

<view class=‘notice-wrap‘ hidden=‘hideNotice‘>
  <view class=‘tongzhitext‘>
    <text class="tongzhi-text">notice</text>
  </view>
  <view bindtap=‘switchNotice‘ class="closeView">x</view>
</view>
 data: 
    //初始化数据
    hideNotice: false,
    notice: ‘‘,

// 点击关闭公告
  switchNotice: function() 
    this.setData(
      hideNotice: true
    )
  ,

 

 

@keyframes remindMessage 
  0% 
    -webkit-transform: translateX(90%);
  

  100% 
    -webkit-transform: translateX(-180%);
  


.tongzhitext 
  margin-right:80rpx;
  margin-left: 10rpx;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;


.tongzhi-text 
  font-size: 28rpx;
  animation: remindMessage 14s linear infinite;
  width: 100%;
  color: #d09868;
  display: block;


.notice-wrap 
  background: #ffebda;
  width: 100%;
  height: 60rpx;
  line-height: 60rpx;
  color: #d09868;
  font-size: 28rpx;


.closeView 
  width: 45rpx;
  height: 45rpx;
  line-height: 45rpx;
  position: absolute;
  right: 20rpx;
  top: 5rpx;
  text-align: center;
  font-size: 35rpx;

 

效果展示

技术图片

 

 

以上是关于微信小程序左右滚动公告栏效果的主要内容,如果未能解决你的问题,请参考以下文章

微信小程序实现左右联动的菜单列表

微信小程序-通知公告滚动提示

ios微信小程序上下滑动效果

微信小程序开发中如何实现侧边栏的滑动效果

微信小程序滚动Tab实现左右可滑动切换

微信小程序——左右滑动切换页面