基本上我試圖創建一個平滑的動畫。當.mouseenter被觸發時,圖像會擴大到其尺寸的兩倍,當鼠標被觸發時,圖像將平滑過渡到原始尺寸。平滑的圖像大小調整使用jQuery .animation和規模
我已經達到了這個使用CSS和.addclass和卸下襬臂類,但對於這個技能培養練習吧的目的,我要回並庫存的jQuery改寫它。我沒有寫的.mouseleave功能又爲我不可能找出.mouseenter
但我清楚地寫.mouseenter事件錯誤。
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<link href="stylesheets/960_12_col.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<style>
body {
font-size:62.5%;
background:url('images/vintageocean.jpg')no-repeat repeat center fixed;
}
#gallery {
padding-top:10em;
}
.first_row {
margin-bottom:15em;
}
</style>
<script>
$(document).ready(function() {
$(".image").css({width : '20em', height : '20em'});
$("image").mouseenter(function() {
$(this).stop().animate({transform, scale(2)}, 3000);
});
});
</script>
</head>
<body>
<div id="wrapper" class="container_12">
<section id="gallery">
<img id="avery" class=" image first_row prefix_2 grid_3 suffix_1" src='images/OAI.jpg' alt= "On Avery Island Album Art">
<img id="overthesea" class=" image first_row prefix_1 grid_3 suffix_2" src='images/ITAOTS.jpg' alt="In the Aeroplane Over the Sea album art">
<img id="beauty" class=" image second_row prefix_2 grid_3 suffix_1" src='images/beauty.jpg' alt="Beauty Demo Album Art">
<img id="everthingIs" class=" image second_row prefix_1 grid_3 suffix_2" src='images/everythingis.jpg' alt="Eveything Is EP Album Art">
</section>
</div>
</body>
編輯:嗯,我才意識到,因爲我使用的是網格系統我不需要真正定義長度和寬度...我想 – nope