English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery slideDown() Effect Method

jQuery Effect Methods

The slideDown() method displays the selected element in a sliding manner.

Note:This method is applicable to elements hidden by jQuery methods and set to display:none in CSS (not visibility:hidden).

This method is usually used withslideUp()Methods can be used together.

Syntax:

$(selector).slideDown(duration, "easing", callback)

Instance

When clicking on "#my-Div” is clicked, this example displays " .panel" on the page:

$("#my-Div").click(function(){
  $(".panel").slideDown();
});
Test to see‹/›

Slide down all <p> elements when the button is clicked:

$("button").click(function(){
  $("p").slideDown();
});
Test to see‹/›

UsedurationParameters:

$("button").click(function(){
  $("p").slideDown(1500);
});
Test to see‹/›

UsecallbackParameters:

$("button").click(function(){
  $("div").slideDown(1500, function(){
    alert("Slide down completed!");
  });
});
Test to see‹/›

Use slow duration and linear easing to slide down all " .panel":

$("#my-Div").click(function(){
  $(".panel").slideDown("slow", "linear");
});
Test to see‹/›

Animate all spans (in this example, words) for quick scrolling, in2Complete each animation within 00 milliseconds:

$("button").click(function(){
  $("span:first-child").slideDown("fast", function(){
    $(this).next().slideDown("fast", arguments.callee);
  });
});
Test to see‹/›

Parameter Value

ParameterDescription
duration(Optional) Determines how long the sliding effect will last. The preset value is400 milliseconds

Possible values:

  • milliseconds (e.g.,100,500,2(e.g., 000, etc.)

  • "fast"

  • "slow"

easing(Optional) A string specifying the speed of the element at different points in the animation. The default value is "swing"

Possible values:

  • "swing"-At the beginning/Move slower at the end and faster in the middle

  • "linear"-Move at a constant speed

callback(Optional) A function to be called once the slideDown() method is completed, called once for each selected element

jQuery Effect Methods