简体   繁体   English

CSS动画无法在Internet Explorer中运行,特别是IE9

[英]CSS animation not working in Internet Explorer, specifically IE9

Here's the code I'm working with. 这是我正在使用的代码。 Works fine in Chrome and Firefox, but not IE and can't figure out what I'm doing wrong. 在Chrome和Firefox中运行良好,但不是IE,也无法弄清楚我做错了什么。 Basically an automatic image slider. 基本上是一个自动图像滑块。 In IE I'm just getting the first img with no sliding. 在IE中我只是第一个没有滑动的img。

Any help would be appreciated. 任何帮助,将不胜感激。

<style type="text/css">
@keyframes slidy {
0% { left: 0%; }
20% { left: 0%; }
25% { left: -100%; }
45% { left: -100%; }
50% { left: -200%; }
70% { left: -200%; }
75% { left: -300%; }
95% { left: -300%; }
100% { left: -400%; }
}

@-webkit-keyframes slidy {
0% { left: 0%; }
20% { left: 0%; }
25% { left: -100%; }
45% { left: -100%; }
50% { left: -200%; }
70% { left: -200%; }
75% { left: -300%; }
95% { left: -300%; }
100% { left: -400%; }
}

@-moz-keyframes slidy {
0% { left: 0%; }
20% { left: 0%; }
25% { left: -100%; }
45% { left: -100%; }
50% { left: -200%; }
70% { left: -200%; }
75% { left: -300%; }
95% { left: -300%; }
100% { left: -400%; }
}

@-o-keyframes slidy {
0% { left: 0%; }
20% { left: 0%; }
25% { left: -100%; }
45% { left: -100%; }
50% { left: -200%; }
70% { left: -200%; }
75% { left: -300%; }
95% { left: -300%; }
100% { left: -400%; }
}

@-ms-keyframes slidy {
0% { left: 0%; }
20% { left: 0%; }
25% { left: -100%; }
45% { left: -100%; }
50% { left: -200%; }
70% { left: -200%; }
75% { left: -300%; }
95% { left: -300%; }
100% { left: -400%; }
}

body { margin: 0; } 
div#slider { overflow: hidden; }
div#slider figure img { width: 20%; float: left; }
div#slider figure { 
  position: relative;
  width: 500%;
  margin: 0;
  left: 0;
  text-align: left;
  font-size: 0;
  animation: 30s slidy infinite; 
  -webkit-animation: 30s slidy infinite; 
  -moz-animation: 30s slidy infinite; 
  -o-animation: 30s slidy infinite; 
  -ms-animation: 30s slidy infinite; 
}
</style>
<div id="slider">
<figure>
    <img alt="" src="#" />
    <img alt="" src="#" />
    <img alt="" src="#" />
    <img alt="" src="#" />
    <img alt="" src="http://static.lakana.com/nxsglobal/lasvegasnow/photo/2016/05/24/5mayors300X100-black-border_1464108603276_8689483_ver1.0.jpg" />
</figure>
</div>

正如您在此处看到的,IE9中不支持CSS动画: http//caniuse.com/#feat=css-animation

Yeah the problem is having to use IE. 是的,问题是必须使用IE浏览器。 If it's for a client you can tell them you can't make this work on legacy browsers, maybe display something in place of it (ideally a message to upgrade their browser) 如果它是针对客户端的,你可以告诉他们你不能在传统浏览器上做这个工作,也许代替它显示一些东西(理想情况下是升级浏览器的消息)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM