fadeIn và fadeOut jQuery 3
RUN
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Example of jQuery Fade-In and Fade-Out Effects with Callback</title> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <style> p{ padding: 15px; background: #DDA0DD; } </style> <script> $(document).ready(function () { // Hiển thị thông báo khi hiệu ứng fadeout hoàn thành $(".out-btn").click(function () { $("p").fadeOut("slow", function () { alert("fade-out hoàn thành."); }); }); // Hiển thị thông báo khi hiệu ứng fadein hoàn thành $(".in-btn").click(function () { $("p").fadeIn("slow", function () { alert("fade-in hoàn thành."); }); }); }); </script> </head> <body> <button type="button" class="out-btn">Fade Out Paragraphs</button> <button type="button" class="in-btn">Fade In Paragraphs</button> <p>This is a paragraph.</p> </body> </html>
PHÓNG TO