animate() : 执行 CSS 属性集的自定义动画。
- 第一个参数 : {} 运动的值和属性
- 第二个参数 : 时间(运动快慢) 默认:400
- 第三个参数 : 运动形式 只有两种运动形式(默认:swing(慢快慢) linear(匀速))
- 第四个参数 : 回调函数
$('div').click(function(){
$(this).animate({width:'300px'},2000,'linear',function(){
$(this).animate({height:'300px'},2000);
});
});
delay() : 延迟下一项运动
stop() : 停止当前正在运行的动画,只会阻止当前运动
stop(true) : 阻止当前以及后续的所有运动
stop(true,true) : 可以立即停止当前运动到指定的目标点
finish() : 立即停止所有运动到指定目标点
$(function(){
$('div').click(function(){
$(this).animate({width:'300px'},2000).delay(1000).animate({height:'300px'},2000);
});
$('input').click(function(){
$('div').stop(); // 默认:只会阻止当前运动
//$('div').stop(true); // 阻止当前以及后续的所有运动
//$('div').stop(true,true); // 可以立即停止当前运动到指定的目标点
//$('div').finish(); // 立即停止所有运动到指定目标点
})
})
世界以痛吻我,要我回报以歌。
加油~我一定可以的!