gpt4 book ai didi

html - CSS 幻灯片在 Firefox 中不起作用

转载 作者:行者123 更新时间:2023-11-28 11:12:42 24 4
gpt4 key购买 nike

我有点卡住了,试图让以下代码在 Firefox 中正常运行,它在 Chrome 中运行良好,但在 firefox 中不起作用,如果有人能提供帮助,我将很高兴。

CSS

.SlidingPhotoFrame{ max-width:100%;  -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; border: 1px solid #bbe3ff; padding:5px; margin-bottom:10px;  background-color:white; }

.SlidingPhoto {
padding-top: 50.20%; /* 450px/800px = 0.5625 */
margin:0; text-align:center;

background:url(Slideshow/1.JPG)) center top no-repeat;
background-size: cover;
-moz-background-size: cover; /* Firefox 3.6 */
background-position: center; /* Internet Explorer 7/8 */

animation-name:PhotoFrames;
animation-duration:20s;
animation-timing-function:ease-in-out;
animation-delay:0s;
animation-iteration-count:infinite;
animation-play-state:running;

/* Safari and Chrome: */
-webkit-animation-name:PhotoFrames;
-webkit-animation-duration:20s;
-webkit-animation-timing-function:ease-in-out;
-webkit-animation-delay:0s;
-webkit-animation-iteration-count:infinite;
-webkit-animation-play-state:running;
}


@keyframes PhotoFrames
{
0% {background:url(Slideshow/1.JPG) center top no-repeat; }
23% {background:url(Slideshow/1.JPG) center top no-repeat; }

25% {background:url(Slideshow/2.JPG) center top no-repeat; }
47% {background:url(Slideshow/2.JPG) center top no-repeat; }

50% {background:url(Slideshow/3.JPG) center top no-repeat; }
74% {background:url(Slideshow/3.JPG) center top no-repeat; }

75% {background:url(Slideshow/4.JPG) center top no-repeat; }
97% {background:url(Slideshow/4.JPG) center top no-repeat; }

100% {background:url(Slideshow/1.JPG) center top no-repeat; }
}

@-webkit-keyframes PhotoFrames /* Safari and Chrome */
{
0% {background:url(Slideshow/1.JPG) center top no-repeat; }
23% {background:url(Slideshow/1.JPG) center top no-repeat; }

25% {background:url(Slideshow/2.JPG) center top no-repeat; }
47% {background:url(Slideshow/2.JPG) center top no-repeat; }

50% {background:url(Slideshow/3.JPG) center top no-repeat; }
74% {background:url(Slideshow/3.JPG) center top no-repeat; }

75% {background:url(Slideshow/4.JPG) center top no-repeat; }
97% {background:url(Slideshow/4.JPG) center top no-repeat; }

100% {background:url(Slideshow/1.JPG) center top no-repeat; }
}

** HTML **

<div class="SlidingPhotoFrame">
<figure class="SlidingPhoto"></figure>
</div>

如果有更好的方法来做同样的事情,请提出建议,我喜欢尽可能保持代码简单,只要有可能。还没有检查 Safari 或 IE...任何建议也很好。

最佳答案

您可以查看以下基于现代跨浏览器的示例。我认为您需要使用 -moz 前缀才能在 Mozilla Firefox 上工作。

-moz-animation-name:PhotoFrames;
-moz-animation-duration:20s;
-moz-animation-timing-function:ease-in-out;
-moz-animation-delay:0s;
-moz-animation-iteration-count:infinite;
-moz-animation-play-state:running;

请引用jsfiddle上的这个

关于html - CSS 幻灯片在 Firefox 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21902202/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com