我在这里有一个简单的 jQuery fadeIn/Out 脚本:
$(document).ready(
function(){
$("#home li").hover(
function(){ $("img", this).fadeIn("400"); },
function() { $("img", this).fadeOut("400"); }
);
});
在这里使用 CSS:
#home a:hover img{
width:210px;
}
#home a {
text-decoration:none;
color:#000;
}
#home img {
width:0px;
margin-right:10px;
}
#home {
list-style: none;
margin: 0;
padding: 0;
text-align:right;
font-family: JeanLucWeb-Thin;
font-size:75px;
line-height:80%;
text-decoration:none;
color:#000;
}
和html:
<div id="main">
<center>
<ul id="home">
<li><a href="news.php"><img src="images/header_1.png" alt=""/>NEWS</a></li>
<li><a href="about.php"><img src="images/header_2.png" alt=""/>ABOUT</a></li>
<li><a href="adventuresofpaulandmarian.php"><img src="images/header_3.png" alt=""/>FILM</a></li>
<li><a href="bardybunch.php"><img src="images/header_4.png" alt=""/>THEATER</a></li>
<li><a href="contact.php"><img src="images/header_5.png" alt=""/>CONTACT</a></li>
</ul>
</center>
</div>
您可以在这里查看最终结果:http: //michaelherbig.com/jaystern/index.php
这个问题是当你将鼠标悬停在链接上时,它似乎在淡入的图像之后添加了一个新行。没有 JavaScript,最终结果看起来很好,这意味着没有新行,但我想要淡入淡出效果.