Jquery学习之旅之 动画 animate
2016-04-17 14:10
453 查看
Jquery学习之旅之 动画 animate
基本语法: $(selector).animate({params},speed,callback);
必须的params定义形成动画的css;
Speed参数是指定动画的时间
Callback是一个回调函数,表示动画完成之后执行的函数
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<title>Insert title here</title>
<style type="text/css">
*{
font-size:24px;
font-family: "微软雅黑";
}
.anii{width:100px;height:60px;background-color:
red;position:
absolute;}
</style>
</head>
<body>
<button id="start">开始</button>
<div class="anii">你好啊!</div>
<script type="text/javascript" src="jquery/jquery-2.1.1.js"></script>
<script type="text/javascript" src="jquery/jquery-2.1.1.min.js"></script>
<script type="text/javascript">
$(document).ready(
function()
{
$("#start").on("click",function(){
$(".anii").animate({left:'250px',fontSize:'36px',height:'300px'},"slow",function(){alert("完成");});
});
}
);
</script>
</body>
</html>
基本语法: $(selector).animate({params},speed,callback);
必须的params定义形成动画的css;
Speed参数是指定动画的时间
Callback是一个回调函数,表示动画完成之后执行的函数
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<title>Insert title here</title>
<style type="text/css">
*{
font-size:24px;
font-family: "微软雅黑";
}
.anii{width:100px;height:60px;background-color:
red;position:
absolute;}
</style>
</head>
<body>
<button id="start">开始</button>
<div class="anii">你好啊!</div>
<script type="text/javascript" src="jquery/jquery-2.1.1.js"></script>
<script type="text/javascript" src="jquery/jquery-2.1.1.min.js"></script>
<script type="text/javascript">
$(document).ready(
function()
{
$("#start").on("click",function(){
$(".anii").animate({left:'250px',fontSize:'36px',height:'300px'},"slow",function(){alert("完成");});
});
}
);
</script>
</body>
</html>
相关文章推荐
- jquery 规范
- jQuery学习笔记
- jQuery实现隐藏标签
- html基础开发-jQuery框架基础语法攻略(攻略一)
- 献给和我合作的过得前端童靴们:jquery源码分析--核心函数(创建选择器筛选document元素)
- jQuery读取json文件
- JQuery基础
- 无刷新 减少服务器负担 jQuery remove方法
- a毛 jquery 学习记 5 基础DOM和CSS操作1
- 非常棒的jQuery图片轮播效果
- jQuery个性化图片轮播效果
- Jquery学习之旅之Jquey滑动实现手风琴效果
- JQuery学习之旅之淡入淡出
- JQuery学习之旅之显示和影藏
- 非常棒的jQuery图片轮播效果
- jquery中文本域光标操作(选中、添加、删除、获取)
- jQuery自己定义绑定的魔法升级版
- jQuery中:first,:first-child,first()的使用区别
- JQuery API Reference
- [JavaScript/JQuery] JS禁用浏览器退格键