zoukankan      html  css  js  c++  java
  • vue 跑马灯 代码

    <template>
      <div>
            <div class="contentBoxBTc">
                <div class="marquee-scroll" :style="' '+msgWidth+'rem;'">
                        <div  class="marquee-li" :style="'animation-duration:'+msgWidth*2.6+'s;'">{{msg}}</div>
                        <!-- <div  class="marquee-li" :style="'animation-delay:'+msgWidth+'s;animation-duration:'+msgWidth*2+'s;'">{{msg}}</div> -->
                        <!-- ***在国海APP里,两个都用marquee-li的absolue字号会变形,是浏览器问题**** -->
                        <div  class="marquee-lib" :style="'animation-delay:'+msgWidth*1.3+'s;animation-duration:'+msgWidth*2.6+'s;'">{{msg}}</div>
                </div>
            </div> 
      </div>
    </template>
    
    <script>
    
    
    export default {
      name: 'index',
        data(){
            return {
                msgWidth:0,
                msg:''
            }
        },
      components: {
        
      },
        methods:{
            setMsg(){
                
                this.msg='本年获得的积分,将于2020-12-31自动过期,请尽快使用喔~积分消耗优先使用即将到期积分。';
                this.msgWidth=this.msg.length*0.11
            }
        },
        mounted(){
            this.setMsg()
        }
    }
    </script>
    <style lang="scss" scoped>
        .contentBoxBTC{
          position: fixed;
          left:0;
          top:0;
           100%;
          z-index: 20;
          background:rgba(29,34,40,1);
        }
        @keyframes marquee {
            0% {
               left: 100%;
            }
            100% {
                left: -100%;
            }
        }
        .marquee-scroll{
            height: 100%;
            overflow: hidden;
            position: absolute;
            top: 0;
            right: 0;
            .marquee-li{
                100%;
                position: absolute;
                left:100%;
                top: 0;
                height: 100%;
                -webkit-animation: marquee  linear infinite;
            animation: marquee  linear infinite;
            }
        }        
        @keyframes marqueeb {
            0% {
               margin-left: 100%;
            }
            100% {
                margin-left: -100%;
            }
        }
        
        .marquee-lib{
                100%;
                margin-left:100%;
                height: 100%;
                -webkit-animation: marqueeb  linear infinite;
            animation: marqueeb  linear infinite;
            }
        
    </style>
  • 相关阅读:
    git 比较两个分支日志和文件的差异
    Interspeech 2020调研:文本前端
    centOS 7 修改分辨率、图形与命令行界面切换
    pdf表格提取camelot安装教程
    CFS任务的负载均衡——2
    CFS任务的负载均衡(框架篇)——(1)
    ftrace笔记一
    红黑树rbtree学习笔记
    一. scheduler相关结构体简介
    cpu_capacity、task_util、cpu_util计算方法
  • 原文地址:https://www.cnblogs.com/ovocake/p/13255191.html
Copyright © 2011-2022 走看看