jQuery实现动画效果的实例代码
<styletype="text/css">
table{border:1pxsolid#666;}
tabletd{border:1pxsolid#eee;width:200px;height:200px;}
img{width:200px;height:200px;border:none;position:relative;}
</style>
<scriptsrc="jquery-1.9.1.js"type="text/javascript"></script>
<scripttype="text/javascript">
$(function(){
// $("img").click(function(){
// $("img").animate({left:"-=200px"},2000).animate({left:"-=200px"},2000)
// .animate({left:"+=400px",top:"-=200px"},1).animate({left:"-=200px"},2000).animate({left:"-=200px"},2000)
// .animate({left:"+=400px",top:"-=200px"},1).animate({left:"-=200x"},2000).animate({left:"-=200px"},2000)
// })
vari=0;varc=0;
$("img").click(function(){
if(c<3){
if(i==2&c==0){$("img").animate({left:"+=400px",top:"-=200px"},1);c++}
elseif(i==2&c==1){$("img").animate({left:"-=200px"},2000);c++}
elseif(i==2&c==2){$("img").animate({left:"-=200px"},2000);c=0;i++;}
elseif(i==3&c==0){$("img").animate({left:"+=400px",top:"-=200px"},1);c++}
elseif(i==3&c==1){$("img").animate({left:"-=200px"},2000);c++}
elseif(i==3&c==2){$("img").animate({left:"-=200px"},2000);c++;}
else{$("img").animate({left:"-=200px"},2000);i++;}
}
})
})
</script>
</head>
<body>
<tablecellpadding="0"cellspacing="0">
<tr>
<td></td><td></td><td></td>
</tr>
<tr>
<td></td><td></td><td></td>
</tr>
<tr>
<td></td><td></td><td><imgsrc="images/2.gif"alt="奔跑的小人"/></td>
</tr>
</table>
</body>
</html>
相关文章
- jwplayer html插件,jQuery插件JWPlayer视频播放器用法实例分析
- jquery动画效果实例_动画js
- jquery validation engine ajax验证,jQuery Validation Engine 表单验证「建议收藏」
- JQuery Ajax详解编程语言
- JQuery运用ajax注册用户实例(后台asp.net)
- jquery异步请求实例代码
- 关于锚点跳转及jQuery下相关操作与插件
- jquery入门—选择器实现隔行变色实例代码
- jQuery旋转插件—rotate支持(ie/Firefox/SafariOpera/Chrome)
- JQuery动画和停止动画实例代码
- jquery图片放大镜功能的实例代码
- ajax.net+jquery无刷新三级联动的实例代码
- jquery延迟执行实例介绍
- jquery利用ajax调用后台方法实例
- jquery设置元素相对于另一个元素的top值(实例代码)
- JQuery验证jsp页面属性是否为空(实例代码)
- jquery改变disabled的boolean状态的三种方法
- jQuery:delegate中select()不起作用的解决方法(实例讲解)
- jquery+ajax+C#实现无刷新操作数据库数据的简单实例
- jquery获取颜色在ie和ff下的区别示例介绍
- jquery的ajax异步请求接收返回json数据实例
- jquery为a标签绑定click事件示例代码
- jquery的clone方法应用于textarea和select的bug修复
- jQuery中document与window以及load与ready区别详解
- JQuery中的事件及动画用法实例
- jquery操作HTML5的data-*的用法实例分享
- JQuery动画与特效实例分析