挑戰(zhàn)實(shí)戰(zhàn)題
使用CSS樣式與jQuery分步驟實(shí)現(xiàn)車動(dòng)畫向下開動(dòng)效果
要求:
1、單擊車圖片,車圖片向下移動(dòng)500px,移動(dòng)時(shí)間設(shè)置600微秒。
任務(wù)
CSS樣式定位車圖片位置
1、為使車可以動(dòng)起來(lái),首先使用position、top、left進(jìn)行定位。
用jQuery代碼讓車動(dòng)起來(lái)
1、鼠標(biāo)滑過(guò)圖片事件寫好。
2、鼠標(biāo)滑過(guò)圖片后觸發(fā)動(dòng)作:車圖片向下移動(dòng)(使用animate方法改變top屬性實(shí)現(xiàn)動(dòng)畫)。
<!DOCTYPE html>
<html>
<head>
<title>停車動(dòng)畫</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="style.css" rel="stylesheet" type="text/css">
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<img class="car" src="http://img1.sycdn.imooc.com//5343d553000107a107200701.jpg" width="350" height="341"/>
</body>
</html>
$(document).ready(function(){
});
*{ padding:0px; margin:0px; }
body{
background:#D5DEE7;
}
.car{
}
請(qǐng)驗(yàn)證,完成請(qǐng)求
由于請(qǐng)求次數(shù)過(guò)多,請(qǐng)先驗(yàn)證,完成再次請(qǐng)求