使用jquery实现的折叠展开源码,供以后参考使用。
<!DOCTYPE html>
<html>
<head>
<script src="jquery-1.10.2.js"></script>
<script type="text/javascript">
var flag = 1;
$(document).ready(function(){
$(".flip").click(function(){
if (0 == flag) {
$(".panel").slideUp("10000");
flag = 1;
} else {
$(".panel").slideDown("10000");
flag = 0;
}
});
});
</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:220px; display:none; }
</style>
</head>
<body>
<div class="panel">
<p>Web 技术</p>
<p>Web 开发</p>
</div>
<p class="flip">请点击这里</p>
</body>
</html>