CSS 滚动动画在 Edge 中不起作用
CSS Scrolling Animation not working in Edge
我在编写代码的新站点上使用动画滚动一些图像,但我刚刚发现它在 Edge 上不起作用?
这是我的代码,有人知道为什么它不起作用吗? Edge 不能作为最新版本似乎很奇怪 :)
HTML
<div class="photobanner">
<a href="" class="first"><img src="images/debeer-refinish-logo-landscape.svg" width="150" height="47" alt="De-Beer Refinish" style="margin-top:16px;" /></a>
<a href=""><img src="images/dna-custom-paints-logo.svg" width="150" height="63" alt="Custom Paints" style="margin-top:8px;" /></a>
<a href=""><img src="images/earthsense-logo.svg" width="150" height="55" alt="EarthSense by Valspar" style="margin-top:12px;" /></a>
<a href=""><img src="images/sayerlack-logo-portrait.svg" width="150" height="60" alt="Sayerlack" style="margin-top:10px;" /></a>
<a href=""><img src="images/spralac-logo.svg" width="150" height="62" alt="Spralac" style="margin-top:9px;" /></a>
<a href=""><img src="images/vim-logo.svg" width="114" height="70" alt="Valspar Industrial Mix" style="margin-top:5px;" /></a>
<a href=""><img src="images/valspar-refinish-logo.svg" width="150" height="50" alt="Valspar Industrial Mix" style="margin-top:15px;" /></a>
<a href=""><img src="images/debeer-refinish-logo-landscape.svg" width="150" height="47" alt="De-Beer Refinish" style="margin-top:16px;" /></a>
<a href=""><img src="images/dna-custom-paints-logo.svg" width="150" height="63" alt="Custom Paints" style="margin-top:8px;" /></a>
<a href=""><img src="images/earthsense-logo.svg" width="150" height="55" alt="EarthSense by Valspar" style="margin-top:12px;" /></a>
<a href=""><img src="images/sayerlack-logo-portrait.svg" width="150" height="60" alt="Sayerlack" style="margin-top:10px;" /></a>
<a href=""><img src="images/spralac-logo.svg" width="150" height="62" alt="Spralac" style="margin-top:9px;" /></a>
<a href=""><img src="images/vim-logo.svg" width="114" height="70" alt="Valspar Industrial Mix" style="margin-top:5px;" /></a>
</div>
(S)CSS
.photobanner {
overflow: hidden;
height: 80px;
width: 1260px;
padding-bottom: 5px;
a {
display: inline-block;
width: 160px;
height: 80px;
margin: 0 10px;
background-color: #F9F9F9;
//background-color: #000000;
text-align: center;
overflow: auto;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease;
&:hover {
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-o-transform: scale(1.1);
-ms-transform: scale(1.1);
transform: scale(1.1);
-webkit-box-shadow: 0px 3px 5px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 3px 5px rgba(0,0,0,0.2);
box-shadow: 0px 3px 5px rgba(0,0,0,0.2);
}
}
/*keyframe animations*/
.first {
-webkit-animation: bannermove $banner-speed linear infinite;
-moz-animation: bannermove $banner-speed linear infinite;
-ms-animation: bannermove $banner-speed linear infinite;
-o-animation: bannermove $banner-speed linear infinite;
animation: bannermove $banner-speed linear infinite;
}
@keyframes "bannermove" {
0% {margin-left: 0px;}
100% {margin-left: $banner-100;}
}
@-moz-keyframes bannermove {
0% {margin-left: 0px;}
100% {margin-left: $banner-100;}
}
@-webkit-keyframes "bannermove" {
0% {margin-left: 0px;}
100% {margin-left: $banner-100;}
}
@-ms-keyframes "bannermove" {
0% {margin-left: 0px;}
100% {margin-left: $banner-100;}
}
@-o-keyframes "bannermove" {
0% {margin-left: 0px;}
100% {margin-left: $banner-100;}
}
}
可以在 http://www.dbnz.co.nz/2016-preview/
预览站点
提前干杯
动画在 Edge 中确实有效,但您需要对代码进行一些更改。我遵循了 Microsoft Edge 完全支持的位于 here 的 W3C 标准。通过一些小的改动,我能够让横幅动画。同样,这不是完整的代码,而是朝着正确方向迈出的一步,因此您可以解决您的问题。
希望对您有所帮助!
CSS
.photobanner {
overflow: hidden;
height: 80px;
width: 1260px;
padding-bottom: 5px;
position: relative;
}
.photoSlider {
position: absolute;
width: 1260px;
height: 80px;
left: 0;
top: 0;
animation-name: horizontal-slide;
animation-duration: 30s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
@keyframes horizontal-slide {
from {
left: 0;
top: 0;
}
to {
left: -1200px;
}
}
HTML
<div class="photobanner">
<div class="photoSlider">
<a href="" class="first"><img src="images/debeer-refinish-logo-landscape.svg" width="150" height="47" alt="De-Beer Refinish" style="margin-top:16px;" /></a>
<a href=""><img src="images/dna-custom-paints-logo.svg" width="150" height="63" alt="Custom Paints" style="margin-top:8px;" /></a>
<a href=""><img src="images/earthsense-logo.svg" width="150" height="55" alt="EarthSense by Valspar" style="margin-top:12px;" /></a>
<a href=""><img src="images/sayerlack-logo-portrait.svg" width="150" height="60" alt="Sayerlack" style="margin-top:10px;" /></a>
<a href=""><img src="images/spralac-logo.svg" width="150" height="62" alt="Spralac" style="margin-top:9px;" /></a>
<a href=""><img src="images/vim-logo.svg" width="114" height="70" alt="Valspar Industrial Mix" style="margin-top:5px;" /></a>
<a href=""><img src="images/valspar-refinish-logo.svg" width="150" height="50" alt="Valspar Industrial Mix" style="margin-top:15px;" /></a>
<a href=""><img src="images/debeer-refinish-logo-landscape.svg" width="150" height="47" alt="De-Beer Refinish" style="margin-top:16px;" /></a>
<a href=""><img src="images/dna-custom-paints-logo.svg" width="150" height="63" alt="Custom Paints" style="margin-top:8px;" /></a>
<a href=""><img src="images/earthsense-logo.svg" width="150" height="55" alt="EarthSense by Valspar" style="margin-top:12px;" /></a>
<a href=""><img src="images/sayerlack-logo-portrait.svg" width="150" height="60" alt="Sayerlack" style="margin-top:10px;" /></a>
<a href=""><img src="images/spralac-logo.svg" width="150" height="62" alt="Spralac" style="margin-top:9px;" /></a>
<a href=""><img src="images/vim-logo.svg" width="114" height="70" alt="Valspar Industrial Mix" style="margin-top:5px;" /></a>
</div>
</div>
标识符不应包含在引号中。删除那些,您应该会发现动画开始在 Microsoft Edge 中按预期工作:
@keyframes "bannermove" {
...
}
应该改为:
@keyframes bannermove {
...
}
我在编写代码的新站点上使用动画滚动一些图像,但我刚刚发现它在 Edge 上不起作用?
这是我的代码,有人知道为什么它不起作用吗? Edge 不能作为最新版本似乎很奇怪 :)
HTML
<div class="photobanner">
<a href="" class="first"><img src="images/debeer-refinish-logo-landscape.svg" width="150" height="47" alt="De-Beer Refinish" style="margin-top:16px;" /></a>
<a href=""><img src="images/dna-custom-paints-logo.svg" width="150" height="63" alt="Custom Paints" style="margin-top:8px;" /></a>
<a href=""><img src="images/earthsense-logo.svg" width="150" height="55" alt="EarthSense by Valspar" style="margin-top:12px;" /></a>
<a href=""><img src="images/sayerlack-logo-portrait.svg" width="150" height="60" alt="Sayerlack" style="margin-top:10px;" /></a>
<a href=""><img src="images/spralac-logo.svg" width="150" height="62" alt="Spralac" style="margin-top:9px;" /></a>
<a href=""><img src="images/vim-logo.svg" width="114" height="70" alt="Valspar Industrial Mix" style="margin-top:5px;" /></a>
<a href=""><img src="images/valspar-refinish-logo.svg" width="150" height="50" alt="Valspar Industrial Mix" style="margin-top:15px;" /></a>
<a href=""><img src="images/debeer-refinish-logo-landscape.svg" width="150" height="47" alt="De-Beer Refinish" style="margin-top:16px;" /></a>
<a href=""><img src="images/dna-custom-paints-logo.svg" width="150" height="63" alt="Custom Paints" style="margin-top:8px;" /></a>
<a href=""><img src="images/earthsense-logo.svg" width="150" height="55" alt="EarthSense by Valspar" style="margin-top:12px;" /></a>
<a href=""><img src="images/sayerlack-logo-portrait.svg" width="150" height="60" alt="Sayerlack" style="margin-top:10px;" /></a>
<a href=""><img src="images/spralac-logo.svg" width="150" height="62" alt="Spralac" style="margin-top:9px;" /></a>
<a href=""><img src="images/vim-logo.svg" width="114" height="70" alt="Valspar Industrial Mix" style="margin-top:5px;" /></a>
</div>
(S)CSS
.photobanner {
overflow: hidden;
height: 80px;
width: 1260px;
padding-bottom: 5px;
a {
display: inline-block;
width: 160px;
height: 80px;
margin: 0 10px;
background-color: #F9F9F9;
//background-color: #000000;
text-align: center;
overflow: auto;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease;
&:hover {
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-o-transform: scale(1.1);
-ms-transform: scale(1.1);
transform: scale(1.1);
-webkit-box-shadow: 0px 3px 5px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 3px 5px rgba(0,0,0,0.2);
box-shadow: 0px 3px 5px rgba(0,0,0,0.2);
}
}
/*keyframe animations*/
.first {
-webkit-animation: bannermove $banner-speed linear infinite;
-moz-animation: bannermove $banner-speed linear infinite;
-ms-animation: bannermove $banner-speed linear infinite;
-o-animation: bannermove $banner-speed linear infinite;
animation: bannermove $banner-speed linear infinite;
}
@keyframes "bannermove" {
0% {margin-left: 0px;}
100% {margin-left: $banner-100;}
}
@-moz-keyframes bannermove {
0% {margin-left: 0px;}
100% {margin-left: $banner-100;}
}
@-webkit-keyframes "bannermove" {
0% {margin-left: 0px;}
100% {margin-left: $banner-100;}
}
@-ms-keyframes "bannermove" {
0% {margin-left: 0px;}
100% {margin-left: $banner-100;}
}
@-o-keyframes "bannermove" {
0% {margin-left: 0px;}
100% {margin-left: $banner-100;}
}
}
可以在 http://www.dbnz.co.nz/2016-preview/
预览站点提前干杯
动画在 Edge 中确实有效,但您需要对代码进行一些更改。我遵循了 Microsoft Edge 完全支持的位于 here 的 W3C 标准。通过一些小的改动,我能够让横幅动画。同样,这不是完整的代码,而是朝着正确方向迈出的一步,因此您可以解决您的问题。
希望对您有所帮助!
CSS
.photobanner {
overflow: hidden;
height: 80px;
width: 1260px;
padding-bottom: 5px;
position: relative;
}
.photoSlider {
position: absolute;
width: 1260px;
height: 80px;
left: 0;
top: 0;
animation-name: horizontal-slide;
animation-duration: 30s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
@keyframes horizontal-slide {
from {
left: 0;
top: 0;
}
to {
left: -1200px;
}
}
HTML
<div class="photobanner">
<div class="photoSlider">
<a href="" class="first"><img src="images/debeer-refinish-logo-landscape.svg" width="150" height="47" alt="De-Beer Refinish" style="margin-top:16px;" /></a>
<a href=""><img src="images/dna-custom-paints-logo.svg" width="150" height="63" alt="Custom Paints" style="margin-top:8px;" /></a>
<a href=""><img src="images/earthsense-logo.svg" width="150" height="55" alt="EarthSense by Valspar" style="margin-top:12px;" /></a>
<a href=""><img src="images/sayerlack-logo-portrait.svg" width="150" height="60" alt="Sayerlack" style="margin-top:10px;" /></a>
<a href=""><img src="images/spralac-logo.svg" width="150" height="62" alt="Spralac" style="margin-top:9px;" /></a>
<a href=""><img src="images/vim-logo.svg" width="114" height="70" alt="Valspar Industrial Mix" style="margin-top:5px;" /></a>
<a href=""><img src="images/valspar-refinish-logo.svg" width="150" height="50" alt="Valspar Industrial Mix" style="margin-top:15px;" /></a>
<a href=""><img src="images/debeer-refinish-logo-landscape.svg" width="150" height="47" alt="De-Beer Refinish" style="margin-top:16px;" /></a>
<a href=""><img src="images/dna-custom-paints-logo.svg" width="150" height="63" alt="Custom Paints" style="margin-top:8px;" /></a>
<a href=""><img src="images/earthsense-logo.svg" width="150" height="55" alt="EarthSense by Valspar" style="margin-top:12px;" /></a>
<a href=""><img src="images/sayerlack-logo-portrait.svg" width="150" height="60" alt="Sayerlack" style="margin-top:10px;" /></a>
<a href=""><img src="images/spralac-logo.svg" width="150" height="62" alt="Spralac" style="margin-top:9px;" /></a>
<a href=""><img src="images/vim-logo.svg" width="114" height="70" alt="Valspar Industrial Mix" style="margin-top:5px;" /></a>
</div>
</div>
标识符不应包含在引号中。删除那些,您应该会发现动画开始在 Microsoft Edge 中按预期工作:
@keyframes "bannermove" {
...
}
应该改为:
@keyframes bannermove {
...
}