回答編集履歴
1
追記
answer
CHANGED
@@ -27,4 +27,35 @@
|
|
27
27
|
});
|
28
28
|
});
|
29
29
|
|
30
|
-
```
|
30
|
+
```
|
31
|
+
|
32
|
+
# 追記
|
33
|
+
```HTML
|
34
|
+
<script>
|
35
|
+
document.addEventListener ('mouseover',function(e){myfunc(e)});
|
36
|
+
document.addEventListener ('mouseout',function(e){myfunc(e)});
|
37
|
+
document.addEventListener ('mousemove',function(e){myfunc(e)});
|
38
|
+
function myfunc(e){
|
39
|
+
var t=e.target;
|
40
|
+
if(t.nodeName=="DIV" && t.className.match(/(^| )tooltip-body( |$)/)){
|
41
|
+
switch(e.type){
|
42
|
+
case "mouseover":
|
43
|
+
console.log(t.innerHTML+' over!');
|
44
|
+
break;
|
45
|
+
case "mouseout":
|
46
|
+
console.log(t.innerHTML+' out!')
|
47
|
+
break;
|
48
|
+
case "mousemove":
|
49
|
+
console.log(t.innerHTML+' move!');
|
50
|
+
break;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
</script>
|
55
|
+
|
56
|
+
<div class="hoge tooltip-body fuga" style="width:100px;height:100px;background-Color:yellow">yellow</div>
|
57
|
+
<div class="tooltip-body hoge" style="width:100px;height:100px;background-Color:lime">lime</div>
|
58
|
+
<div class="tooltip-body" style="width:100px;height:100px;background-Color:aqua">aqua</div>
|
59
|
+
<div class="hoge" style="width:100px;height:100px;background-Color:red">red</div>
|
60
|
+
```
|
61
|
+
※red領域にはtooltip-bodyクラスが設定されていないので反応しない
|