.finish( [queue ] )Returns: jQuery
Description: Stop the currently-running animation, remove all queued animations, and complete all animations for the matched elements.
-
version added: 1.9.finish( [queue ] )
-
queue (default:
'fx'
)Type: StringThe name of the queue in which to stop animations.
-
When .finish()
is called on an element, the currently-running animation and all queued animations (if any) immediately stop and their CSS properties set to their target values. All queued animations are removed.
If the first argument is provided, only the animations in the queue represented by that string will be stopped.
The .finish()
method is similar to .stop(true, true)
in that it clears the queue and the current animation jumps to its end value. It differs, however, in that .finish()
also causes the CSS property of all queued animations to jump to their end values, as well.
Animations may be stopped globally by setting the property $.fx.off
to true
. When this is done, all animation methods will immediately set elements to their final state when called, rather than displaying an effect.
Example:
Click the Go button once to start the animation, and then click the other buttons to see how they affect the current and queued animations.
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
|
|