css3 keyframes not working in chrome

2019-08-28 18:42发布

For some reason the following code doesn't work in Chrome but in Firefox it does:

p.subtitle{
    margin-top:9px;
    font-size:15px;
    font-family: 'din_mediumregular',Arial, Helvetica, sans-serif;
}

a:hover .option-wrapper p.subtitle{
    -webkit-animation: moveFromRight 600ms ease;
    -moz-animation: moveFromRight 600ms ease;   
    -o-animation: moveFromRight 600ms ease; 
    animation: moveFromRight 600ms ease;        
}


@-webkit-keyframes moveFromRight{
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0%);
    }
}

@-moz-keyframes moveFromRight{
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0%);
    }
}

@-o-keyframes moveFromRight{
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0%);
    }
}

@keyframes moveFromRight{
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0%);
    }
}

Is there something wrong with the code? As you can see it includes -webkit-animation and @-webkit-keyframes so I'm unsure.

2条回答
贼婆χ
2楼-- · 2019-08-28 19:05

Had the same problem but it was due to not adding the iteration count separately

-webkit-animation-name: spin;
-webkit-animation-duration: 4000ms;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: linear;

Didn't work:

-webkit-animation:turning_ccw 4s infinite;

查看更多
叼着烟拽天下
3楼-- · 2019-08-28 19:13

It should be

@-webkit-keyframes moveFromRight{
    from {
        -webkit-transform: translateX(100%);
    }
    to {
        -webkit-transform: translateX(0%);
    }
}
查看更多
登录 后发表回答