forked from Chuyue0/javascript-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjq_shopEffect.html
50 lines (49 loc) · 1.72 KB
/
jq_shopEffect.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>jquery模拟商城商品效果图</title>
<style type="text/css">
*{margin: 0; padding: 0; }
img{display: block;}
#box{width: 790px; height: 361px; margin: 100px auto;}
.double,.single{float: left; width: 158px; overflow: hidden;}
</style>
<script src="js/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
var speed=500;
$("#box").find(".pic").hover(function() {
$(".pic").stop().fadeTo(speed,0.6);
$(this).stop().fadeTo(speed,1);
$(this).children('img').stop().animate({"marginLeft":"-15px"}, speed)
}, function() {
$(".pic").stop().fadeTo(speed,1);
$(this).children('img').stop().animate({"marginLeft":"0"}, speed)
});
});
</script>
</head>
<body>
<div id="box">
<div class="double">
<a href="#" class="pic"><img src="img/01.jpg" alt="" /></a>
<a href="#" class="pic"><img src="img/02.jpg" alt="" /></a>
</div>
<div class="single">
<a href="#" class="pic"><img src="img/03.jpg" alt="" /></a>
</div>
<div class="double">
<a href="#" class="pic"><img src="img/04.jpg" alt="" /></a>
<a href="#" class="pic"><img src="img/05.jpg" alt="" /></a>
</div>
<div class="single">
<a href="#" class="pic"><img src="img/06.jpg" alt="" /></a>
</div>
<div class="double">
<a href="#" class="pic"><img src="img/07.jpg" alt="" /></a>
<a href="#" class="pic"><img src="img/08.jpg" alt="" /></a>
</div>
</div>
</body>
</html>