Syntax:
$(selector).slideUp(speed,callback);
The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or milliseconds.
The optional callback parameter is a function to be executed after the sliding completes.
The following example demonstrates the slideUp()
method:
Step 1:Create index.html file and implement below code.
<div id="flip">Click to slide up panel</div> <div id="panel">Hello world!</div>
Step 2:Implement jquery to use SlideDown method.
<script> $(document).ready(function(){ $("#flip").click(function(){ $("#panel").slideUp("slow"); }); }); </script>
Complete Code For SlideUp Method In JQuery
<!DOCTYPE html> <html> <head> <title>How To Use SlideUp Method In JQuery With Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> </head> <style> body { background: darkolivegreen; } </style> <style> #panel, #flip { padding: 5px; text-align: center; background-color: #e5eecc; border: solid 1px #c3c3c3; } #panel { padding: 50px; } </style> <body> <div class="container"> <br><br><br> <div class="text-center"> <h2 id="color" style="color: White">SlideUp Method In JQuery</h2> </div> <br> <br> <div class="well"> <div id="flip">Click to slide up panel</div> <div id="panel">Hello world!</div> </div> </div> </body> </html> <script> $(document).ready(function(){ $("#flip").click(function(){ $("#panel").slideUp("slow"); }); }); </script>