jQuery中自定义简单动画的实现
2016-03-29 11:33
417 查看
原文链接:http://www.cnblogs.com/Arther-J/p/5332317.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" 2 "http://www.w3.org/TR/html4/strict.dtd"> 3 4 <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> 5 <head> 6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 7 <title>自定义简单动画</title> 8 <meta name="author" content="Administrator" /> 9 <script type="text/javascript" src="script/jquery-1.12.2.js"></script> 10 <style type="text/css"> 11 #panel { 12 position: absolute; 13 width: 100px; 14 height: 100px; 15 border: 1px solid #0050D0; 16 background: #96E555; 17 cursor: pointer; 18 } 19 </style> 20 <!-- Date: 2016-03-29 --> 21 </head> 22 <body> 23 <div id="panel"></div> 24 <script type="text/javascript"> 25 $(function() { 26 var flag = true; 27 $("#panel").bind("click", (function() { 28 if (flag) { 29 $(this).animate({ 30 left : "500px" 31 }, 3000); 32 flag = false; 33 } else { 34 $(this).animate({ 35 left : "10px" 36 }, 3000); 37 flag = true; 38 } 39 })); 40 }); 41 </script> 42 </body> 43 </html>
转载于:https://www.cnblogs.com/Arther-J/p/5332317.html
相关文章推荐
- Jquery实现简单的动画效果代码
- UIImageView动画 、自定义View 和手势的简单实用 Tom 猫 全部功能实现
- jquery实现简单的轮播动画
- Jquery 自定义动画同步进行如何实现?
- 用jQuery实现自定义动画
- jquery 跳到顶部和底部动画2句代码简单实现
- 简单自定义实现jQuery验证
- 用js实现的模拟jquery的animate自定义动画(2.5K)
- jquery 实现动画简单操作
- JQuery实现DIV其他动画效果的简单实例
- 自定义实现ExpandableListView收缩的简单动画效果
- 最简单的用jquery实现动画的跳到顶部和底部
- 用js实现的模拟jquery的animate自定义动画(2.5K)
- Android自定义View如此简单 实现点击动画+进度刷新的提交/下载按钮(填坑面试题)
- Jquery实现简单的动画效果代码
- 用jquery实现动画跳到顶部和底部(这个比较简单)
- jQuery实现简单滚动动画效果
- 用jquery实现动画跳到顶部和底部(这个比较简单)
- 简单的实现一下自定义圆然后平移的小动画
- 自定义动画函数JQuery实现