-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdemo.html
84 lines (70 loc) · 2.83 KB
/
demo.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Shadow animation jQuery plugin - Demos</title>
<style>
body {
margin: 1em 2em;
font-family: "Trebuchet MS",Arial,Helvetica,sans-serif;
}
.box {
float: left;
margin: 0 0 30px 50px;
width: 100px;
height: 100px;
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
line-height: 90px;
text-align: center;
border: 3px solid #a9a9a9;
}
.outer-shadow {
box-shadow: 0 0 10px #000000;
-moz-box-shadow: 0 0 10px #000000;
-webkit-box-shadow: 0 0 10px #000000;
}
.inner-shadow {
box-shadow: inset 0 0 0 #f80;
-moz-box-shadow: inset 0 0 0 #f80;
-webkit-box-shadow: inset 0 0 0 #f80;
}
.drop-shadow {
position: relative;
box-shadow: 8px 8px 15px #666;
-moz-box-shadow: 8px 8px 15px #666;
-webkit-box-shadow: 8px 8px 15px #666;
}
</style>
</head>
<body>
<h2>Example</h2>
<p>Change the shadow to a centered 30-pixel blur with the color blue (#44f):</p>
<code>
$('#box1').animate({boxShadow: '0 0 30px #44f'});
</code>
<h2>Demos (hover)</h2>
<div id="box1" class="box outer-shadow">outer</div>
<div id="box2" class="box inner-shadow">inner</div>
<div id="box3" class="box drop-shadow">clickable</div>
<div id="box4" class="box drop-shadow">negative</div>
<div id="box5" class="box outer-shadow">alpha</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script src="jquery.animate-shadow.js"></script>
<script>
$(document).ready(function() {
// Box 1 animates an outer shadow on hover
$("#box1").hover(function(){ $(this).stop().animate({boxShadow: "0 0 30px #44f"}); }, function(){ $(this).stop().animate({boxShadow: "0 0 10px #000"}); });
// Box 2 animates an inner (inset) shadow on hover
$("#box2").hover(function(){ $(this).stop().animate({boxShadow: "0 0 50px"}, "fast"); }, function(){ $(this).stop().animate({boxShadow: "0 0 0"}, "fast"); });
// Box 3 animates multiple CSS properies (box-shadow and top) on click (mousedown/mouseup)
$("#box3").mousedown(function(){ $(this).stop().animate({boxShadow: "3px 3px 3px", top: 3}, "fast"); }).mouseup(function(){ $(this).stop().animate({boxShadow: "8px 8px 15px", top: 0}, "fast"); });
// Box 4 uses a negative pixel value in its shadow animation (on hover)
$("#box4").hover(function(){ $(this).stop().animate({boxShadow: "-3px -0.5em 3px"}); }, function(){ $(this).stop().animate({boxShadow: "8px 8px 15px"}); });
// Box 5 uses an alpha value to fade its shadow to transparent on hover
$("#box5").hover(function(){ $(this).stop().animate({boxShadow: "0 0 30px rgba(0,0,0,0.01)"}); }, function(){ $(this).stop().animate({boxShadow: "0 0 10px rgba(0,0,0,1)"}); });
});
</script>
</body>
</html>