syntax:animate ( properties, options )
return type:void, element
content:ใช้กำหนด ให้เกิดการเคลื่อนไหว แบบ animation
โดย properties ให้กำหนด ลักษณะของ css ที่ต้องการให้เป็นไป
และ options ใช้กำหนด object ซึ่งเป็นค่า config ต่างๆ ได้แก่
duration ใช้กำหนดความเร็วหน่วย millisecond และมี keyword เช่น slow, normal, fast,
complete จะเป็น function ที่ถูกเรียกใช้งานเมื่อ animated complete,
queue ถ้ากำหนด false หมายถึง จะไม่รอ queue คือจะเริ่มแสดง animation ทันที
example:$("#test").each( function() {
$(this).animate( {
width: $(this).width() + 200,
height: $(this).height() + 300
}, { duration: 2000 } );
});
$("#button").click ( function ( ) {
$("div#animate").animate( { "left" : "+=50px" }, , { duration : "slow" } ); );
});
$("#button").click ( function ( ) {
$("div#animate").animate( {
width: "70%",
opacity: 0.4,
marginLeft: "0.6in",
fontSize: "3em",
borderWidth: "10px"
}, { duration : 1500 } );
});
$("#button").click ( function ( ) {
$("div#animate").animate ( {
width: "toggle",
height: "toggle"
}, { duration : 3000 } );
});
$("#button").click( function ( ) {
$("div#animate").animate( {
width: ["toggle", "swing"],
height: ["toggle", "swing"],
opacity: "toggle"
}, {
duration : 2000,
complete : function ( ) {
alert ( "Animation complete." );
} );
} );