jQuery slideDown with easing
Asked Answered
H

5

12

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
});
Heterogynous answered 4/11, 2009 at 14:4 Comment(0)
O
26

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});
Overbear answered 4/11, 2009 at 14:7 Comment(0)
E
14

You can use the animate method with jQueryUI and the easing effects like this:

$(".demo").animate({height: "hide"}, 1500, "easeInQuad", function(){});
Excretory answered 4/11, 2009 at 15:12 Comment(2)
This worked perfectly for me - no need for another plugin. Thanks.Choanocyte
Link is broken.Littrell
F
4

Easing In and Out:

            $("#SignIn").click(function () {

                $(".divSlideTop").slideDown({
                    duration: 1000,
                    easing: "easeInQuad"
                });
            });

            $("#close").click(function () {

                $(".divSlideTop").slideUp({
                    duration: 1000,
                    easing: "easeOutQuad"
                });
            });
Fromm answered 6/11, 2013 at 10:2 Comment(0)
J
-1
$('.class').slideDown(400,'easeInQuad');

Quotes not need for numeric.

Jacinthe answered 10/11, 2013 at 12:25 Comment(0)
U
-2

Have a look at my pen Demo you simple to use $(element).slideUp({duration:1000});

Universalist answered 3/5, 2014 at 1:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.