【发布时间】:2013-12-04 10:20:06
【问题描述】:
我有一个小的 jQuery 动画函数,它可以在除 IE 之外的所有浏览器中运行。这是我的代码: HTML:
<div class="container">
<div class="bg"></div>
<div class="bgHover"></div>
</div>
CSS:
.container{width:54px; height:54px;}
.bgHover{background: url("../images/shine.png") no-repeat scroll -150px 0 rgba(0, 0, 0, 0); width:54px; height:54px; position: absolute; top: 8px; left: 8px;}
.bg{background-color:black; width:54px; height:54px;}
jQuery:
$(document).ready(function(){
var $e = $(".container")
timer = setInterval(function(){
$e.find(".bgHover").stop().animate({backgroundPosition: 0},500,function(){
$e.find(".bgHover").css("background-position","-99px 0");
$e.find(".bgHover").animate({backgroundPosition: '99px 0'});
});
},2500);
});
请找到上面的代码,它可以在除 IE 之外的所有浏览器中运行。
【问题讨论】:
-
请记住,IE
-
@RajaprabhuAravindasamy:有什么解决办法吗?
-
什么IE版本?因为您的代码适用于 ie 9 和 10
-
@GabyakaG.Petrioli:是的,它在 IE8 中不起作用。
标签: jquery html css internet-explorer jquery-animate