我希望在页面加载时隐藏帖子回复,然后在单击链接时切换:
html:
<!-- the post div-->
<div class="post">
<!-- the post content -->
<div class="clicker">click me</div>
<!-- end of the post -->
</div>
<!--begin replies div -->
<div class="container">
<div class="reply">
text in here
</div>
<div class="reply">
text in here
</div>
<div class="reply">
text in here
</div>
</div>
<!--- end replies div -->
<!-- repeat again etc-->
CSS:
.container {
display: none;
}
jQuery:
$(function() {
$(".clicker").click(function() {
$(this).closest('.container').toggle('blind');
});
});
jsfiddle:
http://jsfiddle.net/rwone/grBkm/9/(已解决的解决方案)