回答編集履歴

2

追記

2018/04/17 11:41

投稿

yambejp
yambejp

スコア114775

test CHANGED
@@ -63,3 +63,51 @@
63
63
  <div id="fuga">#fuga</div>
64
64
 
65
65
  ```
66
+
67
+
68
+
69
+ # 追記
70
+
71
+ ちょっと考え直しました。こんな感じですか?
72
+
73
+ ```javascript
74
+
75
+ $(function(){
76
+
77
+ $('.current').css("background-Color","red");
78
+
79
+ $('#g_menu li').on('mouseover',function(){
80
+
81
+ $(this).css("background-Color","red").siblings().css("background-Color","");
82
+
83
+ });
84
+
85
+ $('#g_menu ul').on('mouseout',function(){
86
+
87
+ $(this).find('.current').css("background-Color","red").siblings().css("background-Color","");
88
+
89
+ });
90
+
91
+ });
92
+
93
+ ```
94
+
95
+ ```HTML
96
+
97
+ <div id="g_menu">
98
+
99
+ <ul>
100
+
101
+ <li class="current">1</li>
102
+
103
+ <li>2</li>
104
+
105
+ <li>3</li>
106
+
107
+ <li>4</li>
108
+
109
+ </ul>
110
+
111
+ </div>
112
+
113
+ ```

1

sample

2018/04/17 11:41

投稿

yambejp
yambejp

スコア114775

test CHANGED
@@ -9,3 +9,57 @@
9
9
  mouseoverに対してmouseoutが必要になるのでは?
10
10
 
11
11
  もしくはhoverで処理を列記するかです。
12
+
13
+
14
+
15
+ # sample
16
+
17
+
18
+
19
+ ```javascript
20
+
21
+ $(function(){
22
+
23
+ $('#hoge').hover(
24
+
25
+ function(){
26
+
27
+ $(this).css("color","red");
28
+
29
+ },
30
+
31
+ function(){
32
+
33
+ $(this).css("color","");
34
+
35
+ },
36
+
37
+ );
38
+
39
+ $('#fuga').on({
40
+
41
+ "mouseover":function(){
42
+
43
+ $(this).css("color","blue");
44
+
45
+ },
46
+
47
+ "mouseout":function(){
48
+
49
+ $(this).css("color","");
50
+
51
+ },
52
+
53
+ });
54
+
55
+ });
56
+
57
+ ```
58
+
59
+ ```HTML
60
+
61
+ <div id="hoge">#hoge</div>
62
+
63
+ <div id="fuga">#fuga</div>
64
+
65
+ ```