回答編集履歴

1

変更

2018/09/21 12:45

投稿

yambejp
yambejp

スコア114845

test CHANGED
@@ -45,3 +45,67 @@
45
45
  </div>
46
46
 
47
47
  ```
48
+
49
+
50
+
51
+ # 修正
52
+
53
+ 全体の色でしたか・・
54
+
55
+ ```javascript
56
+
57
+ <style>
58
+
59
+ body.coral {background-Color:coral; color:red;}
60
+
61
+ body.yellow {background-Color:yellow; color:lime;}
62
+
63
+ body.skyblue{background-Color:skyblue;color:aqua;}
64
+
65
+ </style>
66
+
67
+ <script>
68
+
69
+ $( function() {
70
+
71
+ $( '#sample [data-color]' ).on('click',function () {
72
+
73
+ $('body').removeClass('coral yellow skyblue').addClass($(this).data('color'));
74
+
75
+ } );
76
+
77
+ } );
78
+
79
+ </script>
80
+
81
+ <body>
82
+
83
+ <div id="sample">
84
+
85
+ <p>
86
+
87
+ hogehogehogehogehoge
88
+
89
+ </p>
90
+
91
+ <p>
92
+
93
+ <span id="backgroundColorCoral" data-color="coral" >coral</span>
94
+
95
+ <span id="backgroundColorYellow" data-color="yellow" >yellow</span>
96
+
97
+ <span id="backgroundColorSkyblue" data-color="skyblue">skyblue</span>
98
+
99
+ </p>
100
+
101
+ <p>
102
+
103
+ </p>
104
+
105
+ </div>
106
+
107
+ fugafugafugafugafuga
108
+
109
+ </body>
110
+
111
+ ```