回答編集履歴

1

情報の追加。

2018/02/24 14:56

投稿

kei344
kei344

スコア69426

test CHANGED
@@ -19,3 +19,53 @@
19
19
  } );
20
20
 
21
21
  ```
22
+
23
+
24
+
25
+ ---
26
+
27
+
28
+
29
+ **追記:**
30
+
31
+
32
+
33
+ さっきのは元のコードを少し変更しただけでテストしていなかったのですが、いまいち挙動がおかしかったので、取り急ぎ修正しました。
34
+
35
+
36
+
37
+ ```JavaScript
38
+
39
+ $( ".stripeTable" ).each( function() {
40
+
41
+ var $_t = $( this );
42
+
43
+ $_t.find("td").mouseover( function() {
44
+
45
+ $_t.find("td:nth-child("+($( this ).parent().children().index(this)+1)+")").addClass("hover");
46
+
47
+ } ).mouseout( function() {
48
+
49
+ $_t.find("td:nth-child("+($( this ).parent().children().index(this)+1)+")").removeClass("hover");
50
+
51
+ } );
52
+
53
+ } );
54
+
55
+ ```**動くサンプル:**[https://jsfiddle.net/eoy13q8o/](https://jsfiddle.net/eoy13q8o/)
56
+
57
+
58
+
59
+ ---
60
+
61
+
62
+
63
+ ちなみに`.size()`はjQuery3で削除されているので使うなら`.length`を使いましょう。
64
+
65
+
66
+
67
+ 【.size() | jQuery API Documentation】
68
+
69
+ [http://api.jquery.com/size/](http://api.jquery.com/size/)
70
+
71
+ > version deprecated: 1.8, removed: 3.0