您的位置:首页 > Web前端 > JQuery

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>   
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: