Contents:
.queue( [queueName ] )Returns: Array
Description: Show the queue of functions to be executed on the matched elements.
-
version added: 1.2.queue( [queueName ] )
-
queueNameType: StringA string containing the name of the queue. Defaults to
fx
, the standard effects queue.
-
Example:
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
|
|
Demo:
.queue( [queueName ], newQueue )Returns: jQuery
Description: Manipulate the queue of functions to be executed, once for each matched element.
-
version added: 1.2.queue( [queueName ], newQueue )
-
version added: 1.2.queue( [queueName ], callback )
-
queueNameType: StringA string containing the name of the queue. Defaults to
fx
, the standard effects queue. -
callbackThe new function to add to the queue, with a function to call that will dequeue the next item.
-
fx
) is used. Queues allow a sequence of actions to be called on an element asynchronously, without halting program execution. The typical example of this is calling multiple animation methods on an element. For example:
1
|
|
fx
queue to be called only once the sliding transition is complete.
.queue()
method allows us to directly manipulate this queue of functions. Calling .queue()
with a callback is particularly useful; it allows us to place a new function at the end of the queue. The callback function is executed once for each element in the jQuery set.
1
2
3
4
5
|
|
1
2
3
|
|
.queue()
, we should ensure that .dequeue()
is eventually called so that the next function in line executes.
1
2
3
4
|
|
Examples:
Example 1
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
|
|
Demo:
Example 2
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
|
|