JQuery - IE6 - 如何同时淡出和淡入?
我有一个绝对位置 div 序列,假设
<div>...</div>
<div style="display:none">...</div>
<div style="display:none">...</div>
<div style="display:none">...</div>
我使用 jQuery 编写了一个简单的幻灯片代码,
currentDiv.fadeOut('slow');
nextDiv.fadeIn('slow');
它在 FF/Chrome/Safari/IE7/IE8 中完美运行,但在 IE6 中不起作用。我发现在IE6中,fadeOut和fadeIn不像其他浏览器那样同时发生,fadeIn总是在fadeOut完成后开始。有什么想法吗?
I have a sequence of position absolute div, say
<div>...</div>
<div style="display:none">...</div>
<div style="display:none">...</div>
<div style="display:none">...</div>
I wrote a simple slide code using jQuery
currentDiv.fadeOut('slow');
nextDiv.fadeIn('slow');
It works perfectly in FF/Chrome/Safari/IE7/IE8, but not in IE6. I found in IE6, fadeOut and fadeIn not occur simultaneously as in other browsers, fadeIn always begin after fadeOut is completed. any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我刚刚尝试了这个示例,淡入和淡出在 IE6 中同时工作:
我修改了示例: http://docs.jquery.com/Effects/animate#paramsoptions
我之前注意到,在实际的 div 中而不是在 css 文件中或通过 jquery 将样式显示设置为 none 有时会导致问题。尝试只给每个 div 一个 displaynone 类,而不是设置它们的样式标签。希望这有帮助,祝你好运!
I just tried this example and both a fadeIn and fadeOut work at the same time in IE6:
I modified the example from: http://docs.jquery.com/Effects/animate#paramsoptions
I've noticed before that setting the styles display to none in the actual div instead of in the css file or via jquery can sometimes cause issues. Try just giving each div a class of displaynone instead of setting their style tag. Hopefully this helps and good luck!
您检查过这个网站吗:
http://www.geeksucks.com/ toolbox/23-jquery-fade-in-fade-out-effect.htm
?
这是一个 jQuery 的 goog 插件:
http://malsup.com/jquery/cycle/
Have you checked this site:
http://www.geeksucks.com/toolbox/23-jquery-fade-in-fade-out-effect.htm
?
Here is a goog Plugin for jQuery:
http://malsup.com/jquery/cycle/
您是否尝试过编写自己的动画来实现淡入淡出,而不是使用提供的默认值。我不知道会不会更好,但可能值得一试。
http://docs.jquery.com/Effects/animate
Have you tried writing your own animation to achieve the fades, rather than using the defaults supplied. I don't know that it will be any better, but it might be worth a try.
http://docs.jquery.com/Effects/animate