-
Notifications
You must be signed in to change notification settings - Fork 264
/
Copy pathslideUp.xml
119 lines (115 loc) · 5.46 KB
/
slideUp.xml
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?xml version="1.0"?>
<entry type="method" name="slideUp" return="jQuery">
<title>.slideUp()</title>
<desc>Hide the matched elements with a sliding motion.</desc>
<signature>
<added>1.0</added>
<xi:include href="../includes/duration-argument.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
<xi:include href="../includes/complete-argument.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
</signature>
<signature>
<added>1.0</added>
<xi:include href="../includes/options-argument.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
</signature>
<signature>
<added>1.4.3</added>
<xi:include href="../includes/duration-argument.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
<xi:include href="../includes/easing-argument.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
<xi:include href="../includes/complete-argument.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
</signature>
<longdesc>
<p>The <code>.slideUp()</code> method animates the height of the matched elements. This causes lower parts of the page to slide up, appearing to conceal the items. Once the height reaches 0 (or, if set, to whatever the CSS min-height property is), the <code>display</code> style property is set to <code>none</code> to ensure that the element no longer affects the layout of the page.</p>
<p>Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings <code>'fast'</code> and <code>'slow'</code> can be supplied to indicate durations of <code>200</code> and <code>600</code> milliseconds, respectively. If any other string is supplied, or if the <code>duration</code> parameter is omitted, the default duration of <code>400</code> milliseconds is used.</p>
<p>We can animate any element, such as a simple image:</p>
<pre><code>
<div id="clickme">
Click here
</div>
<img id="book" src="book.png" alt="" width="100" height="123">
</code></pre>
<p>With the element initially shown, we can hide it slowly:</p>
<pre><code>
$( "#clickme" ).on( "click", function() {
$( "#book" ).slideUp( "slow", function() {
// Animation complete.
});
});
</code></pre>
<figure>
<img class="column three" src="/resources/0042_06_21.png" alt=""/>
<img class="column three" src="/resources/0042_06_22.png" alt=""/>
<img class="column three" src="/resources/0042_06_23.png" alt=""/>
<img class="column three" src="/resources/0042_06_24.png" alt=""/>
<figcaption>Figure 1 - Illustration of the <code>slideUp()</code> effect</figcaption>
</figure>
<h4 id="easing">Easing</h4>
<p><strong>As of jQuery 1.4.3</strong>, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called <code>swing</code>, and one that progresses at a constant pace, called <code>linear</code>. More easing functions are available with the use of plug-ins, most notably the <a href="https://jqueryui.com">jQuery UI suite</a>.</p>
<h4 id="callback-function">Callback Function</h4>
<p>If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but <code>this</code> is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole.</p>
<p><strong>As of jQuery 1.6</strong>, the <code><a href="/promise/">.promise()</a></code> method can be used in conjunction with the <code><a href="/deferred.done/">deferred.done()</a></code> method to execute a single callback for the animation as a whole when <em>all</em> matching elements have completed their animations ( See the <a href="/promise/#example-1">example for .promise()</a> ). </p>
</longdesc>
<note id="jquery.fx.off" type="additional" data-title=".slideUp()"/>
<note id="slide-in-ie" type="additional" data-title=".slideDown()"/>
<example>
<desc>Animates all divs to slide up, completing the animation within 400 milliseconds.</desc>
<code><![CDATA[
$( document.body ).on( "click", function() {
if ( $( "div" ).first().is( ":hidden" ) ) {
$( "div" ).show( "slow" );
} else {
$( "div" ).slideUp();
}
} );
]]></code>
<css><![CDATA[
div {
background: #3d9a44;
margin: 3px;
width: 80px;
height: 40px;
float: left;
}
]]></css>
<html><![CDATA[
Click me!
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
]]></html>
</example>
<example>
<desc>Animates the parent paragraph to slide up, completing the animation within 200 milliseconds. Once the animation is done, it displays an alert.</desc>
<code><![CDATA[
$( "button" ).on( "click", function() {
$( this ).parent().slideUp( "slow", function() {
$( "#msg" ).text( $( "button", this ).text() + " has completed." );
});
});
]]></code>
<css><![CDATA[
div {
margin: 2px;
}
]]></css>
<html><![CDATA[
<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>
]]></html>
</example>
<category slug="effects/sliding"/>
<category slug="version/1.0"/>
<category slug="version/1.4.3"/>
</entry>