Примеры для jQuery .slideUp()


Animates all divs to slide up, completing the animation within 400 milliseconds.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>slideUp demo</title>
<style>
div {
background: #3d9a44;
margin: 3px;
width: 80px;
height: 40px;
float: left;
}
</style>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
Click me!
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<script>
$( document.body ).click(function() {
if ( $( "div:first" ).is( ":hidden" ) ) {
$( "div" ).show( "slow" );
} else {
$( "div" ).slideUp();
}
});
</script>
</body>
</html>

Демонстрация:

Animates the parent paragraph to slide up, completing the animation within 200 milliseconds. Once the animation is done, it displays an alert.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>slideUp demo</title>
<style>
div {
margin: 2px;
}
</style>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<div>
<button>Hide One</button>
<input type="text" value="One">
</div>
<div>
<button>Hide Two</button>
<input type="text" value="Two">
</div>
<div>
<button>Hide Three</button>
<input type="text" value="Three">
</div>
<div id="msg"></div>
<script>
$( "button" ).click(function() {
$( this ).parent().slideUp( "slow", function() {
$( "#msg" ).text( $( "button", this ).text() + " has completed." );
});
});
</script>
</body>
</html>

Демонстрация: