jquery 无法在 IE 中运行
我有一个用 jQuery 制作的简单动画,但由于某种原因在 IE8 和以前的版本中不起作用。这是我的代码:
$(document).ready(function(){
$('.circle.pink').animate({display: 'block'}, 800, function(){
$(this).animate({right: 446}, 1200, 'easeOutExpo')
});
$('.circle.green').animate({display: 'block'}, 2000, function(){
$(this).animate({right: 20}, 800)
});
$('.circle.blue').animate({display: 'block'}, 2800).animate({right: -100}, 800, function(){
$(this).css('z-index', '4')
}).animate({right: 0}, 1000, 'easeOutExpo');
});
这是 html:
<div class="circles-wrap">
<div class="circle green"></div>
<div class="circle pink">
<article class="intro">
<span class="logo left"></span>
<p>Lorem ipsum....</p>
</article>
</div>
<div class="circle blue"></div>
</div>
和 css:
.circle{
width:514px;
height:514px;
display: block;
}
.circle.pink{ background:url('../images/c-pink.png'); position:absolute; right:0; z-index: 3;}
.circle.blue{ background:url('../images/c-blue.png'); position:absolute; right:0; z-index: 2;}
.circle.green{ background:url('../images/c-green.png'); position:absolute; right:0; z-index: 1;}
知道为什么它不起作用吗?逗号似乎在正确的位置。
提前致谢,
毛罗
I have a simple animation made in jQuery but for some reason doesn't work in IE8 and previous versions. here's my code:
$(document).ready(function(){
$('.circle.pink').animate({display: 'block'}, 800, function(){
$(this).animate({right: 446}, 1200, 'easeOutExpo')
});
$('.circle.green').animate({display: 'block'}, 2000, function(){
$(this).animate({right: 20}, 800)
});
$('.circle.blue').animate({display: 'block'}, 2800).animate({right: -100}, 800, function(){
$(this).css('z-index', '4')
}).animate({right: 0}, 1000, 'easeOutExpo');
});
here's the html:
<div class="circles-wrap">
<div class="circle green"></div>
<div class="circle pink">
<article class="intro">
<span class="logo left"></span>
<p>Lorem ipsum....</p>
</article>
</div>
<div class="circle blue"></div>
</div>
and the css:
.circle{
width:514px;
height:514px;
display: block;
}
.circle.pink{ background:url('../images/c-pink.png'); position:absolute; right:0; z-index: 3;}
.circle.blue{ background:url('../images/c-blue.png'); position:absolute; right:0; z-index: 2;}
.circle.green{ background:url('../images/c-green.png'); position:absolute; right:0; z-index: 1;}
Any idea why it doesn't work? The commas seem to be in the right place.
Thanks in advance,
Mauro
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
display 不是可以在 animate() 中使用的 css 属性,animate 需要具有数值的属性。
也许这会引发 IE 强制退出的错误。
display is not a css-property you can use inside animate(), animate expects properties with numeric values.
Maybe this is throwing an error which IE forces to quit.