回答編集履歴
1
コード修正
answer
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
後から追加された要素にもイベントを設定したい場合には、次のように書くといいと思います。
|
2
2
|
```javascript
|
3
|
+
$(function(){
|
3
|
-
$(document).on("mouseenter", ".thumbnail", function(e) {
|
4
|
+
$(document).on("mouseenter", ".thumbnail", function(e) {
|
4
|
-
|
5
|
+
$(this).find('.operation_list').css('display', 'block');
|
6
|
+
});
|
7
|
+
$(document).on("mouseleave", ".thumbnail", function(e){
|
8
|
+
$('.operation_list').css('display', 'none');
|
9
|
+
});
|
5
10
|
});
|
6
|
-
$(document).on("mouseleave", ".thumbnail", function(e){
|
7
|
-
$('.operation_list').css('display', 'none');
|
8
|
-
});
|
9
11
|
```
|
10
12
|
`hover`は`on`を使うと書けないので、このような形になります。
|