iphone的微信浏览器和Safari下, keyframes中,不支持background-size?

发布于 2022-09-04 10:30:15 字数 1290 浏览 14 评论 0

less代码如下

.keyframes (@name, @frames) {
    @-webkit-keyframes @name { @frames(); }
    @-moz-keyframes @name { @frames(); }
    @-o-keyframes @name { @frames(); }
    @keyframes @name { @frames(); }
}
.animationName(@name){
    -webkit-animation-name: @name;
    animation-name: @name;
}
.keyframes (shipTab, {
     0% {
        background:url(img/shipAni1.jpg) no-repeat;
        background-size:cover;
    }
    25%{
        background:url(img/shipAni2.jpg) no-repeat;
        background-size:cover;
    }
    50%{
        background:url(img/shipAni3.jpg) no-repeat;
        background-size:cover;
    }
    75% {
        background:url(img/shipAni4.jpg) no-repeat;
        background-size:cover;
    }
    100% {
        background:url(img/shipAni1.jpg) no-repeat;
        background-size:cover;
    }
});
.shipTab{
    .animationName(shipTab);
   animation-iteration-count:infinite;
}
.ship{
    width: 12rem;
    height: 10rem;
}
.animatedMd{
    -webkit-animation-duration: 1s;
    animation-duration: 1s;
    -webkit-animation-fill-mode: both;
    animation-fill-mode: both;
}

html

<div class=" ship  animatedMd shipTab"></div>

在安卓浏览器和微信浏览器中均显示正常
但是在iphone的Safari和微信浏览器中,backgroundimg的size都显示的原始大小

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无边思念无边月 2022-09-11 10:30:15

遇到相同问题, 请问解决了吗?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文