jQuery中通过animate做一个简单的上下滑动的动画案例
来源:互联网 发布:手机网络慢怎么办 编辑:程序博客网 时间:2024/05/22 12:23
先说一下案例的目的。鼠标移动过去时,做上下切换动作,鼠标离开上下切换动作消失。当然,不是简单的展示和关闭。看源代码:
<body><div id="main"> <ul> <li>天空<div>1019</div></li> <li>第三人称<div>1019</div> </li> <li>马甲上的绳<div>1019</div></li> <li>妥协<div>1019</div></li> <li>马赛克<div>1019</div></li> </ul></div></body>
样式要求:
@charset "utf-8";/* CSS Document */#main ul li { width: 200px; height: 200px; list-style-type: none; float: left; border: solid 1px red; margin-right:10px; position: relative; overflow:hidden;}ul li div { height: 200px; width: 200px; position:absolute; z-index:12233; background-color:blue; top:200px; left:0px;}* { margin: 0; list-style-type: none; padding: 0; text-decoration: none;}@charset "utf-8";/* CSS Document */#main ul li { width: 200px; height: 200px; list-style-type: none; float: left; border: solid 1px red; margin-right:10px; position: relative; overflow:hidden;}ul li div { height: 200px; width: 200px; position:absolute; z-index:12233; background-color:blue; top:200px; left:0px;}* { margin: 0; list-style-type: none; padding: 0; text-decoration: none;}
最后写jQuery代码:
<script> $(function(){ $("#main ul li").hover( function(){ $(this).children().stop(true,true).animate( {top:"200px"},300 ) }, function(){ $(this).children().stop(true,true).animate( {top:"0px"},300 ) } ) });</script>
特别要注意加上:stop(true,true)进行控制动画的显示。不然就会导致操作完后,动画效果还在继续。
0 0
- jQuery中通过animate做一个简单的上下滑动的动画案例
- jQuery的动画-上下滑动
- jquery的animate(简单动画)
- jquery中animate动画的小例子
- 关于火狐中使用jquery的animate做动画效果的问题解决
- swift初探:一些简单的实用性方法和一个上下滑动拉伸图片的简单动画
- jQuery动画animate()的使用
- jQuery animate() 自定义的动画。
- 【jQuery】调用animate()方法制作简单的动画效果
- #jquery 和 animate 封装一个带动画的弹框
- JQuery的animate()实现菜单滑动
- jquery.animate自定义动画的函数
- jQuery动画animate的stop方法
- jquery animate自定义动画的使用感受
- 一个简单的通过上下左右键移动div的案例--可用于游戏的用户操作界面
- 一个JQuery做Ajax提交的案例
- jQuery中动画animate(上)
- jQuery中动画animate(下)
- 2016.4.22 java笔记 Stream
- 照片的裁剪和压缩
- OpenGL粒子系统
- c#发送和接收get,post消息
- Bestcoder Pro.ID 2010 水仙花数
- jQuery中通过animate做一个简单的上下滑动的动画案例
- Object-c 编程之道 IOS设计模式解析
- tp框架中三次登陆密码错误之后锁定
- Android studio 获取应用签名
- C++中定义和声明的区别与小结
- QT QLabel新创建时显示中文乱码
- Android自定义开关按纽:SwitchButton
- 时间与整型数据/时间戳转换
- 非常可乐