美文网首页
小程序实现跑马灯效果组件

小程序实现跑马灯效果组件

作者: 张大娃创业笔记 | 来源:发表于2019-01-22 15:10 被阅读0次

小程序实现跑马灯效果组件
wxml:

 <view class="marquee">
      <view class="content">
        <text>{{homedata.post[0].post_title}}</text>
        <text style="display: inline-block; width: 5em;"></text>
        <text>{{homedata.post[0].post_title}}</text>
        <text style="display: inline-block; width: 5em;"></text>
        <text>{{homedata.post[0].post_title}}</text>
        <text style="display: inline-block; width: 5em;"></text>
      </view>
    </view>

wxss:

@keyframes kf-marque-animation{ 0% { transform: translateX(0); } 100% { transform: translateX(-33.3%); } }
.marquee{
    width: 100%;
    height: 60rpx;
    line-height: 60rpx;
    background: #fff;
    border: none;
    display: block;
    margin: 0 auto;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: clip;
    position: relative;
    font-size: 28rpx;
}
.marquee .content{
    display: inline-block;
    position: relative;
    padding-right: 0px;
    animation: kf-marque-animation 11.3s linear infinite;
    white-space: nowrap;
}

相关文章

网友评论

      本文标题:小程序实现跑马灯效果组件

      本文链接:https://www.haomeiwen.com/subject/rxhljqtx.html