Only the first parameter is required; the others are optional.
jQuery even tries (and succeeds) to be smart and enables any of the optional parameters to
appear in any order.
$("#elementID").animate(
{ height: 'toggle', opacity: 'toggle' },
"fast",
"easein",
function(){alert('done!');}
);
nNote Easing uses mathematics to adjust the speed of the animation over time. The animation might start
slowly and then speed up as it gets close to the end (or vice versa), creating a more natural feel than an animation
that doesn??™t change in speed.
Easing effects are handled via a jQuery plug-in, which is an additional function that ties
into the jQuery namespace. The supported easing effects are handled by the jQuery Easing
Plugin, available from http://gsgd.co.uk/sandbox/jquery.easing.php. Common easing
CHAPTER 6 n VISUAL EFFECTS 145
effects include easein and easeout, along with fancier effects such as bouncein/bounceout and
backin/backout.
You can find more jQuery plug-ins at http://docs.jquery.com/Plugins.
Mootools
Mootools is made by the same folks who gave you Moo.fx, which gained popularity because
it was small (3K), came with a compact version of Prototype dubbed Prototype Lite (5K),
and focused strictly on animations. This time around, the developers dropped the Prototype
requirement and created a variety of useful components. The effects are broken down into
a number of components (similar to Script.
Pages:
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