页面html
<div class="outbox">
<p class="heading">Header-1 </p>
<div class="content">Lorem ipsum dolor sit amet</div>
<p class="heading">Header-2</p>
<div class="content">Lorem ipsum dolor sit amet</div>
<p class="heading">Header-3</p>
<div class="content">Lorem ipsum dolor sit amet</div>
</div>
CSS
.outbox
{
margin: 0;
padding: 0;
}
.heading
{
background-color: #FF6666;
border: 1px solid #FF5050;
text-align: center;
font-weight: bold;
margin: 1px;
padding: 3px 10px;
cursor: pointer;
float: right;
width: 300px;
height:25px;
}
.content
{
background-color: #FFCCCC;
}
查询
<script type="text/javascript">
$(document).ready(function() {
$(".content").hide();
$(".heading").click(function()
{
$(this).next(".content").slideToggle(500);
});
});
</script>
当我单击内容的任何标题时,展开部分始终显示在页面顶部。如何在标题下方显示它?先感谢您。