I want to take a regular jQuery show/hide, like the slideDown method: $('p').slideDown('fast'); and make it so that it slows down as it gets closer to the end, providing a somewhat animated effect as opposed to the default linear rate. I forget how this is done. Via the callback function somehow?
A:
See this please. You can use the slideToggle function and specify the speed to it like this:
slideToggle('slow');
slideToggle('fast');
slideToggle('2000');
Sarfraz
2010-01-31 06:07:52
+1
A:
You're referring to easing. This is available in some jQuery effects, but not all of them. Earlier in 2009, LearningjQuery.com did an article on this very topic demonstrating how you can add it to your jQuery animations: http://www.learningjquery.com/2009/02/quick-tip-add-easing-to-your-animations
Jonathan Sampson
2010-01-31 06:10:47
+1 Someone needed to vote one of these answers up. And the link you provide is a nice simple example of easing and the easing plugin.
Doug Neiner
2010-01-31 06:40:37
+1
A:
Hey Doug (great name :)
Its called "easing" and jQuery supports two easing methods: "swing" (default) and "linear". What you want can be achieved by using the easing
plugin by itself, or jquery ui core (which also includes the easing plugin). That site has a number of examples how to use it.
Once you have included the plugin, you can use it like this:
$('p').slideDown('fast', "easeOutQuart");
Doug Neiner
2010-01-31 06:11:29