.slideToggle()
Run
↔
<!doctype html> <html lang="vi"> <head> <meta charset="utf-8"> <title>Học web chuẩn</title> <script src="https://code.jquery.com/jquery-latest.js"></script> <style> div { background-color: blue; display: none; float: left; margin-right: 20px; height: 100px; width: 150px; } p { clear: both; } </style> <script> $(function(){ $('button').click(function(){ $('div').slideToggle(2000,function(){ $(this).css('background-color','red'); }); }); }); </script> </head> <body> <p><button>Click</button></p> <div>Thành phần div</div> </body> </html>