-
Notifications
You must be signed in to change notification settings - Fork 0
/
index_2.html
72 lines (59 loc) · 2.08 KB
/
index_2.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Parallax.js | Interactive Example</title>
<!-- Styles -->
<script src="jquery-2.2.1.min.js"></script>
<script src="snap.svg-min.js"></script>
<style>
#svg {
width:640px;
height: 640px;
}
</style>
<script type="application/javascript">
$(function() {
var s1 = Snap("#svg");
Snap.load("mario.svg", function(f) {
var layer0 = f.select("#mario");
var original_size = 40;
var hover_size = 32;
var animation_time = 100;
$.each(layer0.selectAll("rect").items, function() {
this.attr({
origX: this.attr('x'),
origY: this.attr('y'),
modX: parseInt(this.attr('x')) + ((original_size-hover_size)/2),
modY: parseInt(this.attr('y')) + ((original_size-hover_size)/2)
});
this.mouseover(function() {
this.animate({
x: parseInt(this.attr('modX')),
y: parseInt(this.attr('modY')),
width: hover_size,
height: hover_size
}, animation_time, mina.easeout);
}).mouseout(function() {
this.stop();
this.animate({
x: parseInt(this.attr('origX')),
y: parseInt(this.attr('origY')),
width: original_size,
height: original_size
}, animation_time*5, mina.easein);
}).click(function() {
alert(this.attr('id'));
});
});
s1.append(layer0);
});
});
</script>
</head>
<body>
<div id="container" class="container">
<svg id="svg"></svg>
</div>
</body>
</html>