动画在IE11中不起作用

时间:2015-03-02 00:30:18

标签: html css3 animation

我有一个滚动的横幅,在IE中不起作用。但在Firefox,Chrome和Opera中运行良好。这是我的HTML:

<div id="container">
            <div class="photobanner">
                <a class="first" href="http://www.site1.com" ><img src="/images/image1.jpg" alt="site1"></img></a>
                <a href="http://www.site2.com"><img src="/images/site2.jpg" alt="site2"></img></a>
                <a href="http://www.site3.ca"><img src="/images/image3.jpg" alt="site3"></img></a>
                <a href="http://www.site4.org"><img src="/images/image4.jpg" alt="site4"></img></a>
                <a href="http://www.site1.com" ><img src="/images/image1.jpg" alt="site1"></img></a>
                <a href="http://www.site2.com"><img src="/images/image2.jpg" alt="site2"></img></a>
            </div>
        </div>

我的理解是-ms-transform应该在IE9及更高版本中运行,但似乎并非如此,这是我的CSS:

.photobanner {
    width: 3805px;
}

.photobanner img {
    height: 175px;
    margin: 25px 0px 25px 0px;
    -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;
}

.photobanner img: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);
    cursor: pointer;

    -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 30s linear infinite;
       -moz-animation: bannermove 30s linear infinite;
        -ms-animation: bannermove 30s linear infinite;
         -o-animation: bannermove 30s linear infinite;
            animation: bannermove 30s linear infinite;
}

@keyframes "bannermove" {
 0% {
    margin-left: 0px;
 }
 100% {
    margin-left: -2545px;  
 }
}

@-moz-keyframes "bannermove" {
 0% {
   margin-left: 0px;
 }
 100% {
   margin-left: -2545px;
 }
}

@-webkit-keyframes "bannermove" {
 0% {
   margin-left: 0px;
 }
 100% {
   margin-left: -2545px;
 }
}

@-ms-keyframes "bannermove" {
 0% {
   margin-left: 0px;
 }
 100% {
   margin-left: -2545px;
 }
}

@-o-keyframes "bannermove" {
 0% {
   margin-left: 0px;
 }
 100% {
   margin-left: -2545px;
 }
}

任何想法我怎么能让它工作?

2 个答案:

答案 0 :(得分:1)

只需从@keyframes名称中删除"引号即可。像这样:

@-webkit-keyframes bannermove {
  0% {
    margin-left: 0px;
  }
  100% {
    margin-left: -2545px;  
  }
}

@keyframes bannermove {
  0% {
    margin-left: 0px;
  }
  100% {
    margin-left: -2545px;  
  }
}

http://jsfiddle.net/z5ep9hjk/1/

它也不会在IE 9 http://caniuse.com/#feat=css-animation上运行,因为它不支持动画属性。

答案 1 :(得分:1)

您必须从@keyframes中删除双引号(")。然后它将在IE11中工作。