开发者

jQuery slideDown with easing

How can use开发者_JAVA技巧 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
});


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});


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

$(".demo").animate({height: "hide"}, 1500, "easeInQuad", function(){});


Easing In and Out:

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

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

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

                $(".divSlideTop").slideUp({
                    duration: 1000,
                    easing: "easeOutQuad"
                });
            });


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

Quotes not need for numeric.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜