<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>slideToggle</title>
<script src="../../file/jquery-1.4.2.min.js" type="text/javascript"></script>
<style type="text/css">
div.panel,p.flip
{
margin:0px;
padding:5px;
text-align:center;
background:#e5eecc;
border:solid 1px #c3c3c3;
}
div.panel
{
height:120px;
display:none;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
$(".flip").click(function() {
$(".panel").slideToggle(1000);
});
});
</script>
</head>
<body>
<div class="panel">
<p>hello,我出现了,欢迎来到jQuery世界</p>
</div>
<p class="flip">请点击这里</p>
</body>
</html>
效果:
点击按钮后: