我怎样才能让它工作,当点击展开它,当再次点击折叠它...如果它已经展开然后说隐藏,如果它已经折叠然后说显示。
下面是到目前为止的代码。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Collapsible Message Panels</title>
<style type="text/css">
*
{
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
#content
{
width: 200px;
height: 100px;
margin: 20px auto;
padding: 20px;
border: 1px dotted #999999;
overflow: hidden;
text-align: justify;
}
</style>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function () {
// Hide the "view" div.
$('one').hide();
$('second').hide();
// Watch for clicks on the "slide" link.
$('div.slide').click(function () {
// When clicked, toggle the "view" div.
$('second').hide();
$('one').slideToggle(400);
return false;
});
$('div.slide1').click(function () {
// When clicked, toggle the "view" div.
$('one').hide();
$('second').slideToggle(400);
return false;
});
});
</script>
</head>
<body>
<div class="slide">
<a href="#" class="slide">Disclaimer-1</a></div>
<div class="slide1" >
| <a href="#" class="slide1">Behavior</a></div>
<div id="one" class="content">
As you can see the structure, the elements of the menu are inside the div with class “menu_list”.
</div>
<div id="second" class="content1">
I’m not a good color chooser so please forgive me for the color combinations. Above CSS code is straight
</div>
<br />
<br />
</body>
</html>