动画在 IE11 中不起作用
Animation Not Working in IE11
我有一个无法在 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;
}
}
我有什么想法可以让它发挥作用吗???
只需从您的@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因为不支持动画属性.
您必须从 @keyframes 中删除双引号 ( "
)。然后它将在 IE11 中工作。
我有一个无法在 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;
}
}
我有什么想法可以让它发挥作用吗???
只需从您的@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因为不支持动画属性.
您必须从 @keyframes 中删除双引号 ( "
)。然后它将在 IE11 中工作。