Skip to content

Commit b5e24e2

Browse files
dmethvinAurelioDeRosa
authored andcommitted
Effects: Clarify that callbacks are per-element
Fixes jquerygh-803 Closes jquerygh-804
1 parent 5138333 commit b5e24e2

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

entries/animate.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
</div>
3333
<h4 id="duration">Duration</h4>
3434
<p>Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The default duration is <code>400</code> milliseconds. 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.</p>
35-
<h4 id="complete">Complete Function</h4>
36-
<p>If supplied, the <code>complete</code> callback function 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, the callback is executed once per matched element, not once for the animation as a whole.</p>
35+
<h4 id="callbacks">Callback Functions</h4>
36+
<p>If supplied, the <code>start</code>, <code>step</code>, <code>progress</code>, <code>complete</code>, <code>done</code>, <code>fail</code>, and <code>always</code> callbacks are called on a <em>per-element</em> basis; <code>this</code> is set to the DOM element being animated. If no elements are in the set, no callbacks are called. If multiple elements are animated, the callback is executed once per matched element, not once for the animation as a whole. Use the <code>.promise()</code> method to obtain a promise to which you can attach callbacks that fire once for an animated set of any size, including zero elements.</p>
3737
<h4 id="basic-usage">Basic Usage</h4>
3838
<p>To animate any element, such as a simple image:</p>
3939
<pre><code>

includes/complete-argument.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0"?>
22
<argument name="complete" type="Function" optional="true">
3-
<desc>A function to call once the animation is complete.</desc>
3+
<desc>A function to call once the animation is complete, called once per matched element.</desc>
44
</argument>

includes/options-argument.xml

+5-5
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@
4141
</argument>
4242
</property>
4343
<property name="complete" type="Function">
44-
<desc>A function to call once the animation is complete.</desc>
44+
<desc>A function that is called once the animation on an element is complete.</desc>
4545
<!-- no parameters -->
4646
</property>
4747
<property name="start" type="Function" added="1.8">
48-
<desc>A function to call when the animation begins.</desc>
48+
<desc>A function to call when the animation on an element begins.</desc>
4949
<argument name="animation" type="Promise">
5050
<desc>An enhanced Promise object with additional properties for the animation</desc>
5151
</argument>
5252
</property>
5353
<property name="done" type="Function" added="1.8">
54-
<desc>A function to be called when the animation completes (its Promise object is resolved).</desc>
54+
<desc>A function to be called when the animation on an element completes (its Promise object is resolved).</desc>
5555
<argument name="animation" type="Promise">
5656
<desc>An enhanced Promise object with additional properties for the animation</desc>
5757
</argument>
@@ -60,7 +60,7 @@
6060
</argument>
6161
</property>
6262
<property name="fail" type="Function" added="1.8">
63-
<desc>A function to be called when the animation fails to complete (its Promise object is rejected).</desc>
63+
<desc>A function to be called when the animation on an element fails to complete (its Promise object is rejected).</desc>
6464
<argument name="animation" type="Promise">
6565
<desc>An enhanced Promise object with additional properties for the animation</desc>
6666
</argument>
@@ -69,7 +69,7 @@
6969
</argument>
7070
</property>
7171
<property name="always" type="Function" added="1.8">
72-
<desc>A function to be called when the animation completes or stops without completing (its Promise object is either resolved or rejected).</desc>
72+
<desc>A function to be called when the animation on an element completes or stops without completing (its Promise object is either resolved or rejected).</desc>
7373
<argument name="animation" type="Promise">
7474
<desc>An enhanced Promise object with additional properties for the animation</desc>
7575
</argument>

0 commit comments

Comments
 (0)