jQuery实现动画效果的实例代码 - Web前端
作者:98wpeu发布时间:2026-06-16分类:网页前端技术浏览:5
复制代码 代码如下:
<style type="text/CSS">
table{border:1px solid #666;}
table td{border:1px solid #eee;width:200px;height:200px;}
img{width:200px;height:200px;border:none;position:relative;}
</style>
<script src="JQuery-1.9.1.JS" type="text/javascript"></script>
<script type="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)
// })
var i = 0; var c = 0;
$('img').click(function () {
if (c < 3) {
if (i == 2 & c == 0) { $('img').animate({ left: '+=400px', top: '-=200px' }, 1); C++ }
else if (i == 2 & c == 1) { $('img').animate({ left: '-=200px' }, 2000); c++ }
else if (i == 2 & c == 2) { $('img').animate({ left: '-=200px' }, 2000); c = 0; i++; }
else if (i == 3 & c == 0) { $('img').animate({ left: '+=400px', top: '-=200px' }, 1); c++ }
else if (i == 3 & c == 1) { $('img').animate({ left: '-=200px' }, 2000); c++ }
else if (i == 3 & c == 2) { $('img').animate({ left: '-=200px' }, 2000); c++; }
else { $('img').animate({ left: '-=200px' }, 2000); i++; }
}
})
})
</script>
</head>
<body>
<TABle cellpadding="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><img src="images/2.gif" alt="奔跑的小人" /></td>
</tr>
</table>
</body>
</html>
- 上一篇:jquery 插件学习(五) - Web前端
- 下一篇:已经是最后一篇了
相关推荐
- jquery 插件学习(五) - Web前端
- 分享20款美化网站的 jQuery Lightbox 灯箱插件 - Web前端
- jQuery事件之键盘事件(ctrl+Enter回车键提交表单等) - Web前端
- jquery 插件学习(六) - Web前端
- jquery图片延迟加载 前端开发技能必备系列 - Web前端
- jQuery操作input type=radio的实现代码 - Web前端
- 基于jquery的鼠标拖动效果代码 - Web前端
- 基于jquery的放大镜效果 - Web前端
- jQuery源码分析-03构造jQuery对象-源码结构和核心函数 - Web前端
- 获得所有表单值的JQuery实现代码[IE暂不支持] - Web前端
- 网页前端技术排行
- 最近发表
-
- WordPress随机显示特色图片插件:Random Post Thumbnails
- KeePass实现Chrome浏览器自动填充密码方法一
- LNMP一键包nginx 301强制跳转到https教程
- KeePass实现Chrome浏览器自动填充密码方法二
- #建站# 免费的VPS管理软件Xshell8/Xftp8中文版下载
- 使用Xshell 8连接VPS教程_电脑登录vps的方法
- WordPress评论界面添加烟花????效果
- 不同浏览器书签同步方案:坚果云+Floccus_详细使用教程
- iOS端KeePassXC客户端APP:Strongbox Password Safe
- 给WordPress评论中的Gravatar头像图片添加ALT属性


