教程集 www.jiaochengji.com
教程集 >  jQuery  >  jquery 教程  >  正文 jquery animate创建动画的小例子

jquery animate创建动画的小例子

发布时间:2015-11-29   编辑:jiaochengji.com
分享一个使用jquery中animate创建动画的例子,学习下jquery animate函数的用法,有需要的朋友参考下。

jquery中animate的用法:
animate( Hash params, String|NumberJavascript 字符串或数字值 speed, String easing , Function callback(可选) 在动画完成时执行的函数 )用于创建自定义动画的函数。

演示例子:
 

复制代码 代码示例:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>jquery animate创建动画-http://www.jbxue.com</title>
<script type="text/javascript" src="/ajaxjs/jquery1.3.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
   $("a").toggle(function(){
     $(".stuff").animate({ height: 'hide', opacity: 'hide' }, 'slow');
   },function(){
     $(".stuff").animate({ height: 'show', opacity: 'show' }, 'slow');
   });
});
</script>

</head>
<body>
<a href="#">text</a>
<div class="stuff">
脚本学堂小编讲解:animate( Hash params, String|NumberJavascript 字符串或数字值 speed, String easing , Function callback(可选) 在动画完成时执行的函数 )
用于创建自定义动画的函数。</div>
</body>
</html>

您可能感兴趣的文章:
jquery animate创建动画的小例子
Jquery 自定义动画概述及示例
jquery animate动画函数用法浅析
jQuery动画animate方法实例分享
Jquery动画animate方法的实例讲解
jquery animate实现图片轮换
jQuery动画效果animate和scrollTop结合使用实例
jQuery Animation实现CSS3动画示例介绍
jquery animate动画方法使用介绍
jQuery动画animate方法使用介绍

关键词: animate  动画   
[关闭]
~ ~