Jquery一个slideToggle搞定div的隐藏与显示

时间:2021-06-28 07:57:57

Jquery一个slideToggle搞定div的隐藏与显示

<!DOCTYPE html>
<html>
<head>
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("#flip").click(function(){
$("#panel").slideToggle("slow");
});
});
</script> <style type="text/css">
#panel,#flip
{
padding:5px;
text-align:center;
background-color:#e5eecc;
border:solid 1px #c3c3c3;
}
#panel
{
padding:50px;
display:none;
}
</style>
</head>
<body> <div id="flip">Click to slide the panel down or up</div>
<div id="panel">Hello world!</div> </body>
</html>

原文:http://www.runoob.com/jquery/jquery-ref-selectors.html