jQuery 1.4 Animation Techniques - Index of
jQuery 1.4 Animation Techniques - Index of jQuery 1.4 Animation Techniques - Index of
If we wish to see how many functions are left in the queue (including the one that is in progress), we could change the console.log line to this: console.log($(this).queue().length); This code would show the following output in Firebug's console: This time our console shows numerically how many items are left in the queue, as shown in the previous screenshot. [ 59 ] Chapter 3 We can use other array methods on the queue if we wish (although this would rarely be useful), such as push() or pop() to add or remove items for example. We can also get a single item from the queue if we wish, by adding square braces and an index number after the call to queue(): console.log($(this).queue()[1]); As shown above, this time the value of the second item is output to the console. As I mentioned earlier, we can see the actual contents of the function using the toString() JavaScript function: console.log($(this).queue()[1].toString);
Managing Animations Running this code produces the following output: The code shown in the previous screenshot won't make much sense to the casual observer as it's been minified, but it's the contents of jQuery's fadeout() method. Pop quiz – viewing the queue 1. What is the easiest way of determining the number of functions in the queue? a. Using the length() method b. Using the length property c. Counting them in Firebug d. By looking at the effectsLeftToRun property of the animated element's fx queue [ 60 ]
- Page 29 and 30: Introduction In addition to animate
- Page 31 and 32: Introduction When not to use animat
- Page 33 and 34: Introduction of the template file"
- Page 35 and 36: Introduction In the previous screen
- Page 37 and 38: Introduction Once our variables hav
- Page 40 and 41: 2 Fading Animations In this chapter
- Page 42 and 43: [ 21 ] Chapter 2 We can control the
- Page 44 and 45: The previous screenshot shows how t
- Page 46 and 47: [ 25 ] Chapter 2 Most of the styles
- Page 48 and 49: 2. What else can be passed into the
- Page 50 and 51: Time for action - creating the dial
- Page 52 and 53: [ 31 ] Chapter 2 For example, the a
- Page 54 and 55: Download from Wow! eBook The follo
- Page 56 and 57: [ 35 ] Chapter 2 The CSS is used mo
- Page 58 and 59: The fadeTo() method is used in the
- Page 60 and 61: [ 39 ] Chapter 2 #messageList table
- Page 62 and 63: [ 41 ] Chapter 2 What just happened
- Page 64 and 65: 2. What format can these arguments
- Page 66 and 67: } var el = $(this); if (el.css("fil
- Page 68 and 69: [ 47 ] Chapter 2 Usually these meth
- Page 70 and 71: Time for action - animations with s
- Page 72 and 73: Download from Wow! eBook [ 51 ] Ch
- Page 74 and 75: 2. Save the changes as toggle.html.
- Page 76 and 77: 3 Managing Animations Like most of
- Page 78 and 79: [ 57 ] Chapter 3 A custom queue tha
- Page 82 and 83: 2. What does the queue() method ret
- Page 84 and 85: [ 63 ] Chapter 3 The argument we su
- Page 86 and 87: [ 65 ] Chapter 3 We pass a callback
- Page 88 and 89: [ 67 ] Chapter 3 The first argument
- Page 90 and 91: Delaying queue execution [ 69 ] Cha
- Page 92 and 93: [ 71 ] Chapter 3 Also note that the
- Page 94 and 95: 4 Sliding Animations Another type o
- Page 96 and 97: Time for action - creating a slide-
- Page 98 and 99: [ 77 ] Chapter 4 header form input
- Page 100 and 101: Pop quiz - sliding elements down 1.
- Page 102 and 103: Download from Wow! eBook }); }); $
- Page 104 and 105: Toggling the slide [ 83 ] Chapter 4
- Page 106 and 107: [ 85 ] Chapter 4 } h2 { margin:0; p
- Page 108 and 109: [ 87 ] Chapter 4 The previous scree
- Page 110 and 111: Pop quiz - using slideToggle 1. Wha
- Page 112 and 113: [ 91 ] Chapter 4 Easing is a great
- Page 114 and 115: [ 93 ] Chapter 4 Home Articles J
- Page 116 and 117: [ 95 ] Chapter 4 3. Save this file
- Page 118 and 119: In the previous screenshot, we see
- Page 120 and 121: Pop quiz - fixing the flicker 1. Wh
- Page 122 and 123: 5 Custom Animations The predefined
- Page 124 and 125: An alternative syntax for animate()
- Page 126 and 127: [ 105 ] Chapter 5 width:295px; marg
- Page 128 and 129: [ 107 ] Chapter 5 What just happene
If we wish to see how many functions are left in the queue (including the one that is in<br />
progress), we could change the console.log line to this:<br />
console.log($(this).queue().length);<br />
This code would show the following output in Firebug's console:<br />
This time our console shows numerically how many items are left in the queue, as shown<br />
in the previous screenshot.<br />
[ 59 ]<br />
Chapter 3<br />
We can use other array methods on the queue if we wish (although this would rarely be<br />
useful), such as push() or pop() to add or remove items for example. We can also get a<br />
single item from the queue if we wish, by adding square braces and an index number after<br />
the call to queue():<br />
console.log($(this).queue()[1]);<br />
As shown above, this time the value <strong>of</strong> the second item is output to the console. As I<br />
mentioned earlier, we can see the actual contents <strong>of</strong> the function using the toString()<br />
JavaScript function:<br />
console.log($(this).queue()[1].toString);