jQuery fadeTo()

fadeTo() animates a matched element to a target opacity. The opacity value ranges from 0 (transparent) to 1 (fully opaque).

fadeTo() Syntax Top ↑

$(selector).fadeTo(duration, opacity);

Fade to 50% Opacity Top ↑

$("#b2").on("click", function () {
    $("#d1").fadeTo("fast", 0.5);
});

Restore Full Opacity Top ↑

$("#b2").on("click", function () {
    $("#d1").fadeTo("fast", 1);
});

Demo: change and restore opacity with fadeTo() →

Use a Different Duration Top ↑

$("#d1").fadeTo("slow", 0.3);

The original collection also demonstrates fade durations on the fadeIn()/fadeOut() speed demo.

← Previous: fadeToggle() · jQuery Effects · Next: slideUp() / slideDown() →






plus2net.com






✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer