jQuery .fadeIn() Reveal Elements by Fading In

Beginner
5 min read
Updated: Nov 2026
3 examples
Effects

Definition

.fadeIn() (since jQuery 1.0) displays matched elements by fading them to opaque (opacity 1). It unhides the element and animates opacity. Returns the jQuery object for chaining.

Syntax

Start with these common calls. Keep them short and readable.

jQuery
$("#book").fadeIn();                    // default 400 ms
$("#book").fadeIn("slow", function () { /* done */ });
$("#panel").fadeIn(600, "linear");

// Unhides + fades to opacity 1
// Unlike .fadeTo() — that does not unhide
CallWhat it does
.fadeIn() Reveal Elements by Fading InLearn jQuery .fadeIn(): reveal hidden elements by animating opacity to opaque since 1.0, duration and easing defaults, per-element callbacks, options object, and compare with show, fadeOut, fadeTo, and fadeToggle.

Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.

Parameters

ParameterDescription
Step 1Select the target ($("#book")).
Step 2Ensure it is hidden (.hide() or CSS display: none).
Step 3On a user action, call .fadeIn() (optional duration / easing / complete).

Return Value

Return ValueDescription
Value / undefinedGetters usually return a value from the first matched element, or undefined when nothing applies.

jQuery Examples

Example 1 — Basic Slow Reveal

From the jQuery docs: fade in a hidden element on click with a complete callback.

jQuery
$("#clickme").on("click", function () {
  $("#book").fadeIn("slow", function () {
    // Animation complete
  });
});
Try It Yourself

How It Works

  1. Hidden start. #book begins with display: none.
  2. Click. The handler calls .fadeIn("slow", …).
  3. Unhide + fade. Display is restored; opacity tweens to 1.

Example 2 — Fade Hidden Divs One by One

Official demo: each click fades in the first remaining hidden div.

jQuery
$("#trigger").on("click", function () {
  $("div:hidden").first().fadeIn("slow");
});
Try It Yourself

How It Works

  1. Selector. div:hidden finds boxes still hidden.
  2. first. Only the next one is chosen.
  3. fadeIn. That box unhides over 600 ms.

Example 3 — Nested Fade in a Callback

Official pattern: fade a block in, then fade nested text in when the first fade finishes.

jQuery
$("a").on("click", function () {
  $(".overlay").fadeIn(3000, function () {
    $(".overlay span").fadeIn(100);
  });
  return false;
});
Try It Yourself

How It Works

  1. Outer. The overlay fades in for 3 seconds.
  2. Complete. The callback runs when that fade ends.
  3. Inner. The nested span fades in quickly (100 ms).

Frequently Asked Questions

.fadeIn() displays matched elements by fading them to full opacity. It animates opacity toward 1 and restores a visible display value so hidden content becomes visible. Use it for a smooth reveal instead of an instant .show().
1) .fadeIn([duration] [, complete]) — optional duration and completion callback. 2) .fadeIn(options) — an options object with duration, easing, queue, step, progress, and Promise-style callbacks. 3) .fadeIn([duration] [, easing] [, complete]) — positional easing since jQuery 1.4.3.
.show() reveals instantly with no transition. .fadeTo() animates to a target opacity but does not unhide elements. .fadeOut() hides by fading to 0. .fadeIn() both unhides and fades to full opacity in one call.
Duration is in milliseconds. Default is 400 ms when omitted. The strings "fast" (200 ms) and "slow" (600 ms) map to preset speeds, the same as other jQuery effect methods.
Once per matched element when that element’s fade finishes — not once for the whole set. Inside the callback, this is the DOM element. Use .promise().done() when you need a single callback after every element completes.
Yes for a visible effect. .fadeIn() is meant for hidden elements (typically display:none via .hide()). Calling it on already-visible, fully opaque elements has little noticeable effect.

Next: .fadeOut() Hide Elements by Fading Out

Hide elements by fading opacity to 0 — the counterpart to .fadeIn().

.fadeOut() Hide Elements by Fading Out tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful