This example describes the use of the Slideup () method in jquery. Share to everyone for your reference. The specific analysis is as follows:
This method dynamically hides all matching elements by changing the height (decreasing up), and can trigger a callback function when the hide is complete.
The Slideup () method adjusts only the height of the element, allowing the matching elements to be hidden in a "sliding" manner.
I. Grammatical structure:
This method can specify the duration of the animation effect and use the default value normal if there is no specified time. For example:
Copy Code code as follows:
$ ("div"). Slideup (5000)
The above code can set the animation effect to complete within 5000 milliseconds (5 seconds).
This method can also trigger a callback function after the animation completes. For example:
Copy Code code as follows:
("div"). Slideup (5000,function () {alert (' Slide down complete! ')});
The code above can trigger the callback function after the animation completes, and a prompt box pops up.
Two. Instance code:
Copy Code code as follows:
<! DOCTYPE html>
<meta charset= "Utf-8" >
<meta name= "Author" content= "http://www.jb51.net/"/>
<style type= "Text/css" >
div{
Background: #060;
width:300px;
height:300px;
color:red;
}
</style>
<title> Cloud-dwelling community </title>
<script type= "Text/javascript" src= "Mytest/jquery/jquery-1.8.3.js" ></script>
<script type= "Text/javascript" >
$ (document). Ready (function () {
$ ("#up"). Click (function () {
$ ("div"). Slideup (5000,function () {alert (' Slide down complete! ')});
})
})
</script>
<body>
<div></div>
<button id= "Up" > Click Up Slide </button>
</body>
In the above code, click on the button, the div will slowly pull up, after completion will pop up a dialog box.
I hope this article will help you with your jquery programming.