Animate
RUN
<!doctype html> <html lang="vi-vn"> <head> <meta charset="utf-8"> <title>animated demo</title> <style> div { background: yellow; border: 1px solid #AAA; width: 80px; height: 80px; margin: 0 5px; float: left; } div.colored { background: green; } </style> <script src="https://code.jquery.com/jquery-1.10.2.js"></script> </head> <body> <button id="run">Run</button> <div></div> <div id="mover"></div> <div></div> <script> // Thêm class colored vào đối tượng HTML đang animate $("#run").click(function () { $("div:animated").addClass("colored"); }); // Hàm tạo hiệu ứng animate liên tục function animateIt() { $("#mover").slideToggle("slow", animateIt); } // Kích hoạt animate animateIt(); </script> </body> </html>
PHÓNG TO