打开页面时没有播放动画的原因是在CSS的动画定义中存在错误。在给html元素添加动画的@keyframes规则中,transform属性中的单词'translteX'拼写错误,应该是'translateX'才是正确的写法。将错误的拼写修改为正确的拼写后,页面应该能够正常播放动画。下面是修改后的代码:

<style>
    html {
        transition: .4s;
        animation-name: slideIn;
        animation-duration: .4s;
    }

    @keyframes slideIn {
        from {
            transform: translateX(100%);
        }
        to {
            transform: translateX(0);
        }
    }
</style>
Webdroid 设置页面动画失效问题解决

原文地址: https://www.cveoy.top/t/topic/qe2H 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录