gpt4 book ai didi

javascript - JQuery - IE6 - 如何同时淡出和淡入?

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:52:18 27 4
gpt4 key购买 nike

我有一个位置绝对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结束后才开始。有什么想法吗?

最佳答案

我刚试过这个例子,在 IE6 中同时出现淡入淡出效果:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>

<script>
$(document).ready(function(){

$(document.body).click(function () {
$("div#one").fadeOut("slow");
$("div#two").fadeIn("slow");

});

});
</script>
<style>
span { color:red; cursor:pointer; }
div { margin:3px; width:80px; display:none;
height:80px; float:left; }
div#one { background:#f00; display:block;}
div#two { background:#0f0; }
div#three { background:#00f; }
</style>
</head>
<body>
<span>Click here...</span>
<div id="one"></div>
<div id="two"></div>
<div id="three"></div>
</body>
</html>

我修改了示例:http://docs.jquery.com/Effects/animate#paramsoptions

我之前注意到,在实际的 div 中而不是在 css 文件中或通过 jquery 将样式显示设置为无有时会导致问题。尝试只给每个 div 一类 displaynone 而不是设置它们的样式标签。希望这对您有所帮助,祝您好运!

关于javascript - JQuery - IE6 - 如何同时淡出和淡入?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2055551/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com