问题
图片加文字的无缝滚动,在手机端的成果总体还行,然而图片在手机某些浏览器会抖得腻害!
谬误写法
不能用 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 浏览器性能剖析