• Css3无缝滚动防抖


    问题

    图片加文字的无缝滚动,在手机端的效果总体还行,但是图片在手机某些浏览器会抖得腻害!

    错误写法

    不能用left,margin-left,像这种写法:

    .donghua.active{
      animation: scoll ease-in-out 1s infinite alternate;
      -webkit-animation: scoll ease-in-out 1s infinite alternate;
    }
    @keyframes scoll  {
      from {
        left: 0;
      }
      to {
        left: -353px;
      }
    }
    -webkit-@keyframes scoll  {
      from {
        left: 0;
      }
      to {
        left: -353px;
      }
    }
    

    方法

    里面的某个元素在手机端会抖动的腻害,改用二维的translate像这样:

    .donghua.active{
      animation: scoll ease-in-out 1s infinite alternate;
      -webkit-animation: scoll ease-in-out 1s infinite alternate;
    }
    @keyframes scoll {
      0% {
        transform: translate(0px, 0px);
      }
    
      100% {
        transform: translate(0px, -353px);
      }
    }
    @-webkit-keyframes scoll {
      0% {
        transform: translate(0px, 0px);
      }
    
      100% {
        transform: translate(0px, -353px);
      }
    }
    

    chrome 浏览器性能分析

  • 相关阅读:
    获取系统版本
    一句代码删除所有子视图
    MAJOR-MINOR-MKDEV
    AF_UNIX和AF_INET域的socket在epoll中的差异
    python-print
    python-class(5)
    python-class(4)
    python-class(3)
    python-class(2)
    python-class(1)
  • 原文地址:https://www.cnblogs.com/yihan123/p/13658367.html
Copyright © 2020-2023  润新知