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

jQuery show() Effect Method

jQuery Effect Methods

The show() method displays hidden elements.

Note:Hidden elements will no longer affect the layout of the page.

Note:If !important is used in the style, for example display: none !important, this method will not override !important.

Note:This method is applicable to elements hidden by jQuery methods, in CSS it is display:none (notvisibility: hidden).

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

Syntax:

$(selector).show(duration, easing, callback)

Example

Show all <p> elements when the button is clicked:

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

UsedurationParameters:

$("button").click(function(){
  $("p").show();1000);
});
Test and see‹/›

UsecallbackParameters:

$("button").click(function(){
  $("div").show();1000, function(){
    alert("DIV visible");
  });
});
Test and see‹/›

Animate all spans (in this example, words) to display quickly, and in200毫秒内完成每个动画:

$("button").click(function(){
  -child
    $(this).next().show("fast", arguments.callee);
  });
});
Test and see‹/›

Parameter Value

ParameterDescription
durationAn optional value that determines how long the display effect will run. The preset value is400 milliseconds

Possible values:

  • milliseconds (e.g.,100,500,2(e.g., 1000, 2000, 3000, etc.)

  • "fast"

  • "slow"

easingAn optional string that specifies the speed of the element at different points of 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

callbackAn optional function called once the show() method is completed for each selected element

jQuery Effect Methods