jQuery實(shí)現(xiàn)動(dòng)畫效果的實(shí)例代碼
<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>
相關(guān)文章
jQuery實(shí)現(xiàn)的簡單在線計(jì)算器功能
這篇文章主要介紹了jQuery實(shí)現(xiàn)的簡單在線計(jì)算器功能,結(jié)合完整實(shí)例形式分析了jQuery實(shí)現(xiàn)簡單四則運(yùn)算的相關(guān)操作技巧,需要的朋友可以參考下2017-05-05
淺析jQuery Ajax請(qǐng)求參數(shù)和返回?cái)?shù)據(jù)的處理
這篇文章主要介紹了淺析jQuery Ajax請(qǐng)求參數(shù)和返回?cái)?shù)據(jù)的處理的相關(guān)資料,需要的朋友可以參考下2016-02-02
用簡潔的jQuery方法toggleClass實(shí)現(xiàn)隔行換色
這篇文章主要介紹了用簡潔的jQuery方法toggleClass實(shí)現(xiàn)隔行換色,很簡單,但很實(shí)用,需要的朋友可以看看2014-10-10
Jquery幻燈片特效代碼分享?鼠標(biāo)點(diǎn)擊按鈕時(shí)切換(1)
這篇文章主要介紹了jQuery實(shí)現(xiàn)幻燈片焦點(diǎn)圖,可實(shí)現(xiàn)非常炫目時(shí)尚的幻燈片效果,非常具有實(shí)用價(jià)值,基本能滿足你在網(wǎng)頁上使用幻燈片(焦點(diǎn)圖)效果,需要的朋友可以參考下2015-08-08
jQuery判斷當(dāng)前點(diǎn)擊的是第幾個(gè)li的代碼
jQuery中如何判斷當(dāng)前點(diǎn)擊的是第幾個(gè)li,使用$(this).index()取得li的下標(biāo),下面的示例,大家可以看看2014-09-09
jQuery選擇器源碼解讀(七):elementMatcher函數(shù)
這篇文章主要介紹了jQuery選擇器源碼解讀(七):elementMatcher函數(shù),本文講解了源碼、功能、參數(shù)、返回函數(shù) 等內(nèi)容,需要的朋友可以參考下2015-03-03
jQuery flip插件實(shí)現(xiàn)的翻牌效果示例【附demo源碼下載】
這篇文章主要介紹了jQuery flip插件實(shí)現(xiàn)的翻牌效果,可實(shí)現(xiàn)類似卡羅牌翻頁的視覺效果,涉及jquery.flip.min.js插件的使用,并附帶demo源碼供讀者下載參考,需要的朋友可以參考下2016-09-09
基于jquery實(shí)現(xiàn)多級(jí)菜單效果
這篇文章主要為大家詳細(xì)介紹了基于jquery實(shí)現(xiàn)多級(jí)菜單效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-07-07

