toggleClass slideToggle

$("#wrapper").toggleClass("toggled");

 $("p").slideToggle(1000);

demo:

<!DOCTYPE html>
<html>
<head>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>

<script src="./jquery-1.11.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".mybutton").click(function(){

$(".notice").slideToggle("slow");
});
});
</script>

<style type="text/css">
div.notice
{
height:320px;
background:#e5eecc;
padding-left: 250px;
display:none;
}

</style>
</head>
<body>

<p>

<div class="notice">
<h1>wellcome</h1>
<p>how to show slideToggle</p>
<p>canyoushowit</p>
</div>
<button class="mybutton"> click me</button>


</body>
</html>

原文地址:https://www.cnblogs.com/rojas/p/4168710.html