这段代码如何判断是向上切换还是向下切换?请帮忙解决。谢谢。
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".flip").click(function(){
$(".panel").slideToggle();
});
});
</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>
</head>
<body>
<div class="panel">
<p>Crap.</p>
</div>
<p class="flip">Show/Hide Panel</p>
</body>
</html>