Cho đoạn HTML và CSS như sau:
<div id="expander"></div>
div#expander{
width: 100px;
height: 100px;
background-color: blue;
}
Yêu cầu: viết code sử dụng jQuery để tạo hiệu ứng động cho thẻ div#expander, mở rộng nó từ 100x100 pixels đến 200x200 pixels trong 3 giây.
Trả lời:
$( "#expander" ).animate(
{
width: "200px",
height: "200px",
},
3000 );