当我单击 div.info 时,它需要再次隐藏/显示:无。我怎样才能做到这一点?
html
<div class="floated">
<a href="#" class="showinfo">link 1</a>
<div class="info">onclick this div hide it again</div>
</div>
js
$(document).ready(function() {
$("a.showinfo").click(function() {
$("div.info").fadeOut();
$(this).next("div.info").fadeIn();
});
});
css
div.info {
display: none;
}
div.floated {
float: left; position:relative; height:100px; width:100px; background:#f00;
}
div.info{
position:absolute; background:#ccc; width:100px; height:100px; top:0;
}
小提琴:http: //jsfiddle.net/KZ3Ky/6/