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


Animates all divs to slide down and show themselves over 600 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>slideDown demo</title>
<style>
div {
background: #de9a44;
margin: 3px;
width: 80px;
height: 40px;
display: none;
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>
<script>
$( document.body ).click(function () {
if ( $( "div:first" ).is( ":hidden" ) ) {
$( "div" ).slideDown( "slow" );
} else {
$( "div" ).hide();
}
});
</script>
</body>
</html>

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

Animates all inputs to slide down, completing the animation within 1000 milliseconds. Once the animation is done, the input look is changed especially if it is the middle input which gets the focus.

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
42
43
44
45
46
47
48
49
50
51
52
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>slideDown demo</title>
<style>
div {
background: #cfd;
margin: 3px;
width: 50px;
text-align: center;
float: left;
cursor: pointer;
border: 2px outset black;
font-weight: bolder;
}
input {
display: none;
width: 120px;
float: left;
margin: 10px;
}
</style>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<div>Push!</div>
<input type="text">
<input type="text" class="middle">
<input type="text">
<script>
$( "div" ).click(function() {
$( this ).css({
borderStyle: "inset",
cursor: "wait"
});
$( "input" ).slideDown( 1000, function() {
$( this )
.css( "border", "2px red inset" )
.filter( ".middle" )
.css( "background", "yellow" )
.focus();
$( "div" ).css( "visibility", "hidden" );
});
});
</script>
</body>
</html>

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