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