-
Notifications
You must be signed in to change notification settings - Fork 0
/
sync.html
65 lines (56 loc) · 1.54 KB
/
sync.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
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<style type="text/css">
svg {
background-color: lightgrey;
height: 400px;
width: 80%;
}
circle.circle {
fill: blue;
}
circle.circle:hover, circle.circle.hover {
fill: red;
}
span.circle {
background-color: blue;
color: white;
}
span.circle:hover, span.circle.hover {
background-color: red;
}
</style>
</head>
<body>
<h1>Hello</h1>
<script src="d3.js" type="text/javascript"></script>
<svg id="infographie">
<circle class="circle" cx="100" cy="100" r="30"></circle>
</svg>
<p>
Y'a du texte, puis là <span class="circle">c'est bon ça</span>, et encore c'est pas fini.
</p>
<script type="text/javascript">
var classes = ["circle"];
function activateHover() {
var elements = document.getElementsByClassName("circle");
for (var i = 0; i < elements.length; i++) {
elements[i].onmouseenter = function(event) {
var elements = document.getElementsByClassName("circle")
for (var i = 0; i < elements.length; i++) {
elements[i].classList.add('hover');
}
event.target.onmouseleave = function() {
for (var i = 0; i < elements.length; i++) {
elements[i].classList.remove('hover');
}
}
};
}
}
activateHover();
</script>
</body>
</html>