Search code examples
jqueryslidedowndurationeasing

Duration time ignored jquery slideDown


I have just achieve to slideDown an element with easeInBounce effect but when I put the duration time, it ignores me...

I put

$(document).ready(function() {
        $( "#hola1" ).slideDown( {easing: "easeInBounce"}, 2899, function() {
        });
    });

And I try to put

$(document).ready(function() {
        $( "#hola1" ).slideDown({
                duration: "3000",
                easing: "easeInBounce"});
    });

But it seems the same...


Solution

  • First, be sure that you have the relevant parts of JQuery easing plugin, as the default jquery library does not contain the "easeInBounce" easing option.

    Next, you're going to want to make the duration part of the options that you are inserting:

    $(document).ready(function() {
        $( "#hola1" ).slideDown( {easing: "easeInBounce", duration: 2899}, function() {
        });
    });
    

    If you were using show() then you could separate them, but even then you have them backwards as duration should come first.

    $(document).ready(function() {
        $( "#hola1" ).show(2899, "easeInBounce", function() {
        });
    });
    

    take a look at this jsfiddle.