jQuery slideDown with easing

Sindre Sorhus picture Sindre Sorhus · Nov 4, 2009 · Viewed 53.6k times · Source

How can use the slideDown() function with easing?

Maybe extend it somehow?

I'm looking for something like this:

jQuery.fn.slideDown = function(speed, easing, callback) {
  return ...
};

So i can use it slide this

$('.class').slideDown('400','easeInQuad');

or this

$('.class').slideDown('400','easeInQuad',function(){
   //callback
});

Answer

Seb picture Seb · Nov 4, 2009

Take a look at this page, which contains many easing functions: http://gsgd.co.uk/sandbox/jquery/easing/

Using that plugin you can do things like:

$(element).slideUp({
    duration: 1000, 
    easing: method, 
    complete: callback});