-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjquery-fx-queues-plugin.html
243 lines (217 loc) · 10.4 KB
/
jquery-fx-queues-plugin.html
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery Fx Queues plugin - Luciano German Panaro's blog</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
<link rel="alternate" type="application/rss+xml" title="Luciano German Panaro's blog feed" href="/feeds.html" />
<link rel="stylesheet" type="text/css" href="/css/reset-min.css" media="all" />
<link rel="stylesheet" type="text/css" href="/css/style.css" media="all" />
<link href="/js/prettify/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="/js/prettify/prettify.js"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-4688088-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body class="" onload="prettyPrint()">
<div id="header">
<div class="onecol">
<h1><a href="/">Luciano German Panaro</a></h1>
<p>
A 24 year-old web enthusiast that
<a href="https://github.com/lucianopanaro">codes</a>,
<a href="http://www.linkedin.com/pub/luciano-panaro/4/a03/229">works</a>,
and
<a href="http://twitter.com/lucianopanaro">blabbers</a>.
News feed addict?
<a href="/feed">Subscribe</a> to the atom feed.
</p>
</div>
</div>
<div id="content">
<div class="onecol">
<div class='post'>
<div class='date'>Liquid error: undefined method `strftime' for nil:NilClass</div>
<h1 class='title'><a href='/jquery-fx-queues-plugin.html'>jQuery Fx Queues plugin</a></h1>
<div class='tags'></div>
<div class='comments'>
<a href='/jquery-fx-queues-plugin.html#disqus_thread' data-disqus-identifier='/jquery-fx-queues-plugin.html'>Comments</a>
</div>
<div class='clearboth'></div>
<div class='postcontent'>
<div class="storycontent">
<p style="border:1px solid #CECC4D;font-weight:bold;padding:5px;">
<a href="http://lucianopanaro.com/jquery-fxqueues-plugin-20/">There is a new version of this plugin for jQuery 1.2.x</a>
</p>
<h2>Introduction</h2>
The <strong>jQuery Fx Queues</strong> plugin is a global queueing (duh!) system that
allows to enqueue effects of different elements, but also keeps jQuery’s default
queueing option.
A <strong>wait</strong> argument was also added to be able to
specify the time to wait before starting the animation.
<hr />
<h2>Download</h2>
<ul>
<li><a href="http://lucianopanaro.com/fxqueues/jquery.fxqueues-1.0.pack.js">Packed (2.92KB)</a></li>
<li><a href="http://lucianopanaro.com/fxqueues/jquery.fxqueues-1.0.js">Source (10.3KB)</a></li>
</ul>
<hr />
<h2>Queues</h2>
A queue is an array that may contain <strong>animations to perform</strong> and/or
<strong>scopes</strong>.
You just have to pass its name (with the animate’s “queue” argument) to add an animation
to a queue. If the queue doesn’t exist, then it creates it automatically.
In case a name is not passed, then a queue for the element is created.
<hr />
<h2>Scopes</h2>
What happens if you needed to enqueue not a single effect, but a group of effects
to be played altogether? This is where <strong>scopes</strong> come to save the day.
A scope is an object that can be contained in a queue. It is an array that contains
<strong>only</strong> animations to perform. When a scope is dequeued, it automatically
plays all the animations it contains.
You just have to pass its name (with the animate’s “scope” argument) to add an animation
to a queue’s scope. If the scope doesn’t exist, then it creates it automatically.
<hr />
<h2>New arguments added to <a href="http://docs.jquery.com/Effects/animate"><em>animate</em></a>:</h2>
<ul>
<li><strong>queue</strong>: <span class="type">(string)</span> Name of the queue. If it doesn’t exist, it creates the new queue.</li>
<li><strong>scope</strong>: <span class="type">(string)</span> Name of the scope.</li>
<li><strong>queuePosition</strong>: <span class="type">(”front”|”end”)</span> Queue position where animation (or scope,
if passed) is queued.</li>
<li><strong>wait</strong>: <span class="type">(int)</span> Milliseconds to wait before starting the animation.</li>
</ul>
<hr />
<h2>Usage:</h2>
animate(properties, speed, easing, callback, queue, scope, queuePosition, wait)
<p class="code">$(”#myId”).animate(
{<strong>marginLeft:</strong> “10px”},
{<strong>speed:</strong> 500,
<strong>queue:</strong> “first”
});</p>
Since these arguments are available in the new
<strong><em>animate</em></strong> implementation,
they can be used in the other effects, like:
<p class="code">$(”#myId”).fadeIn({
<strong>speed:</strong> 500,
<strong>queue:</strong> “first”,
<strong>scope:</strong> “global”,
<strong>wait:</strong> 500
});</p>
<hr />
<h2>Useful functions</h2>
Three functions were created to manage the queues, which can be found in the <strong>jQuery.fxQueues</strong> object.
<ul>
<li><strong>jQuery.fxQueues.clear( queueName )</strong></li>
<li><strong>jQuery.fxQueues.start( queueName )</strong></li>
<li><strong>jQuery.fxQueues.stop( queueName )</strong></li>
</ul>
<hr />
<h3><a href="http://lucianopanaro.com/fxqueues/fxqueues.html" target="_blank">Examples</a></h3>
<hr />
<h3>Changelog</h3>
<ul>
<li><strong>11-21-2007</strong>:
<ul>
<li>Renamed functions (start, stop and clear)</li>
<li>Fixed stop method when stopping an animation queued with a wait time.</li>
</ul>
</li>
<li><strong>11-19-2007</strong>: First release.</li>
</ul>
</div>
</div>
</div>
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = 'lucianopanaro';
var disqus_identifier = '/jquery-fx-queues-plugin.html';
var disqus_url = 'http://lucianopanaro.com/jquery-fx-queues-plugin.html';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
</div>
</div>
<div id="footer">
<div class="onecol">
<div class="content" id="footer_archives">
<h2>Archives</h2>
<ul class="archive_list"><li><a href="/2010/01">January 2010</a> (1)</li>
<li><a href="/2009/03">March 2009</a> (1)</li>
<li><a href="/2009/02">February 2009</a> (1)</li>
<li><a href="/2009/01">January 2009</a> (2)</li>
<li><a href="/2008/11">November 2008</a> (1)</li>
<li><a href="/2008/10">October 2008</a> (3)</li>
<li><a href="/2008/03">March 2008</a> (1)</li>
<li><a href="/2008/02">February 2008</a> (1)</li>
<li><a href="/2007/12">December 2007</a> (2)</li>
<li><a href="/2007/11">November 2007</a> (4)</li>
</ul>
</div>
<div class="content" id="footer_tags">
<h2>Tags</h2>
<ul class="tag_cloud"><li style="font-size:1.1em"><a href="/tags/caching.html">caching</a></li>
<li style="font-size:1.1em"><a href="/tags/carousel.html">carousel</a></li>
<li style="font-size:1.05em"><a href="/tags/rails.html">rails</a></li>
<li style="font-size:1.2em"><a href="/tags/plugin.html">plugin</a></li>
<li style="font-size:1.05em"><a href="/tags/bdd.html">bdd</a></li>
<li style="font-size:1.05em"><a href="/tags/yui.html">yui</a></li>
<li style="font-size:1.2em"><a href="/tags/fxqueues.html">fxqueues</a></li>
<li style="font-size:1.05em"><a href="/tags/oauth.html">oauth</a></li>
<li style="font-size:1.1em"><a href="/tags/rails2.0.html">rails2.0</a></li>
<li style="font-size:1.15em"><a href="/tags/talk.html">talk</a></li>
<li style="font-size:1.05em"><a href="/tags/rspec.html">rspec</a></li>
<li style="font-size:1.05em"><a href="/tags/mashups.html">mashups</a></li>
<li style="font-size:1.05em"><a href="/tags/yahoo.html">yahoo</a></li>
<li style="font-size:1.05em"><a href="/tags/welie.html">welie</a></li>
<li style="font-size:1.05em"><a href="/tags/jquery1.4.html">jquery1.4</a></li>
<li style="font-size:1.05em"><a href="/tags/tip.html">tip</a></li>
<li style="font-size:1.05em"><a href="/tags/rack.html">rack</a></li>
<li style="font-size:1.25em"><a href="/tags/javascript.html">javascript</a></li>
<li style="font-size:1.05em"><a href="/tags/performance.html">performance</a></li>
<li style="font-size:1.05em"><a href="/tags/clearance.html">clearance</a></li>
<li style="font-size:1.05em"><a href="/tags/ruby.html">ruby</a></li>
<li style="font-size:1.1em"><a href="/tags/tutorial.html">tutorial</a></li>
<li style="font-size:1.05em"><a href="/tags/ui patterns.html">ui patterns</a></li>
<li style="font-size:1.05em"><a href="/tags/plaxo.html">plaxo</a></li>
<li style="font-size:1.05em"><a href="/tags/middleware.html">middleware</a></li>
<li style="font-size:1.05em"><a href="/tags/jsmin.html">jsmin</a></li>
<li style="font-size:1.05em"><a href="/tags/openID.html">openID</a></li>
<li style="font-size:1.05em"><a href="/tags/decodeuri.html">decodeuri</a></li>
<li style="font-size:1.1em"><a href="/tags/RoR.html">RoR</a></li>
<li style="font-size:1.45em"><a href="/tags/jquery.html">jquery</a></li>
</ul>
<div class="clearboth"></div>
</div>
<div class="clearboth"></div>
<div id="footer_copy">
<p>Copyright © 2007-2011 Luciano Germán Panaro.</p>
</div>
</div>
</div>
<script type="text/javascript">
var disqus_shortname = 'lucianopanaro';
/* * * DON'T EDIT BELOW THIS LINE * * */
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>
</body>
</html>