我无法让这些图片实现淡入效果,也不知道哪里出了问题。我已经将$(this).fadeIn()
替换为alert("hi")
,弹出窗口显示了。我尝试将代码放在最后,尝试链接到本地jQuery脚本,还尝试在$(document).ready()
中使用$("#eTR1").fadeIN()
,但这些方法都没有奏效:
<!doctype HTML>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script>
$(document).ready(function()
{
$("#eTR1").bind("load", function() { $(this).fadeIn(); });
$("#eTR2").bind("load", function() { $(this).fadeIn(); });
$("#eTR3").bind("load", function() { $(this).fadeIn(); });
$("#eBL1").bind("load", function() { $(this).fadeIn(); });
$("#eBL2").bind("load", function() { $(this).fadeIn(); });
$("#eBL3").bind("load", function() { $(this).fadeIn(); });
});
</script>
</head>
<body>
<aside id="eTRRibbons">
<img id="eTR1" src="res/tr1.png">
<img id="eTR2" src="res/tr2.png">
<img id="eTR3" src="res/tr3.png">
</aside>
<aside id="eBLRibbons">
<img id="eBL1" src="res/bl1.png">
<img id="eBL2" src="res/bl2.png">
<img id="eBL3" src="res/bl3.png">
</aside>
</body>
</html>
并且
html
{
height: 100%;
}
body
{
min-height: 100%;
margin: 0px;
}
#eTR1,#eTR2,#eTR3
{
position: fixed;
top: 0px;
right: 0px;
opacity: 0.0;
filter: alpha(opacity = 0);
}
#eBL1,#eBL2,#eBL3
{
position: fixed;
bottom: 0px;
left: 0px;
opacity: 0.0;
filter: alpha(opacity = 0);
}
我做错了什么?
fadeIn()
与display: none;
配合使用,您应该将其设置为display: none;
而不是不需要的opacity: 0
。 - Madara's Ghost