質問編集履歴

1

modal.html.erbがmodal.jsになってmodal.jsが二つあったのとmodal.html.erbで記述がおかしかったところを修正しました。

2021/02/04 06:57

投稿

koukinagano
koukinagano

スコア1

test CHANGED
File without changes
test CHANGED
@@ -34,198 +34,198 @@
34
34
 
35
35
 
36
36
 
37
+ ```modalhtmlerb
38
+
39
+ <main>
40
+
41
+
42
+
43
+ <h1>お問い合わせ</h1>
44
+
45
+ <a id="modalOpen" class= "modalOpen">問合せ</a>
46
+
47
+
48
+
49
+ <div class="modal" id="modal">
50
+
51
+ <h2>お問い合わせ</h2>
52
+
53
+ <div class="modalContents">
54
+
55
+ fadfaafdajknknkjkada<br>
56
+
57
+ dfgandfsksakfdnvkajn<br>
58
+
59
+ fadfaafdajknknkjkada<br>
60
+
61
+ dfgandfsksakfdnvkajn<br>
62
+
63
+ </div>
64
+
65
+ <a id="modalClose" class= "modalClose">閉じる</a>
66
+
67
+ </div>
68
+
69
+
70
+
71
+ <div class="mask" id="mask"></div>
72
+
73
+
74
+
75
+ </main>
76
+
77
+
78
+
79
+ ```
80
+
81
+
82
+
83
+ ```modalscss
84
+
85
+ main {
86
+
87
+ background-color: rgb(219, 215, 215);
88
+
89
+ padding: 20px;
90
+
91
+ border-radius: 5px;
92
+
93
+ max-width: 1000px;
94
+
95
+ margin: 50px auto;
96
+
97
+ height: 200vh;
98
+
99
+ }
100
+
101
+
102
+
103
+ h1 {
104
+
105
+ font-size: 30px;
106
+
107
+ font-weight: bold;
108
+
109
+ margin-bottom: 30px;
110
+
111
+ }
112
+
113
+
114
+
115
+ .modalOpen, .modalClose {
116
+
117
+ display: flex;
118
+
119
+ align-items: center;
120
+
121
+ justify-content: center;
122
+
123
+ width: 200px;
124
+
125
+ height: 40px;
126
+
127
+ background-color: blue;
128
+
129
+ color: white;
130
+
131
+ font-size: 16px;
132
+
133
+ border-radius: 5px;
134
+
135
+ text-decoration: none;
136
+
137
+ cursor: pointer;
138
+
139
+ }
140
+
141
+
142
+
143
+ .modalClose {
144
+
145
+ margin: 30px auto 0;
146
+
147
+ }
148
+
149
+
150
+
151
+ .modal {
152
+
153
+ position: fixed;
154
+
155
+ top: 50%;
156
+
157
+ left: 50%;
158
+
159
+ transform: translate(-50%,-50%);
160
+
161
+ background-color: rgb(245, 243, 243);
162
+
163
+ padding: 20px;
164
+
165
+ border-radius:5px;
166
+
167
+ min-width: 500px;
168
+
169
+ z-index: 2;
170
+
171
+ opacity:0;
172
+
173
+ visibility: hidden;
174
+
175
+ }
176
+
177
+
178
+
179
+ .modal h2 {
180
+
181
+ font-weight: bold;
182
+
183
+ font-size: 20px;
184
+
185
+ margin-bottom: 10px;
186
+
187
+ }
188
+
189
+
190
+
191
+ .modalContents {
192
+
193
+ line-height: 1.8;
194
+
195
+ }
196
+
197
+
198
+
199
+ .mask {
200
+
201
+ position: fixed;
202
+
203
+ top: 0;
204
+
205
+ left: 0;
206
+
207
+ width: 100%;
208
+
209
+ height: 100%;
210
+
211
+ background-color: rgb(5, 3, 3);
212
+
213
+ opacity: 0.8;
214
+
215
+ z-index: 1;
216
+
217
+ opacity: 0;
218
+
219
+ visibility: hidden;
220
+
221
+ }
222
+
223
+ ```
224
+
225
+
226
+
37
227
  ```modaljs
38
228
 
39
-
40
-
41
- <main>
42
-
43
-
44
-
45
- <h1>お問い合わせ</h1>
46
-
47
- <a id="modalOpen" class= "modalOpen">問合せ</a>
48
-
49
-
50
-
51
- <div class="modal" id="modal">
52
-
53
- <h2>お問い合わせ</h2>
54
-
55
- <div class="modalContents">
56
-
57
- fadfaafdajknknkjkada<br>
58
-
59
- dfgandfsksakfdnvkajn<br>
60
-
61
- fadfaafdajknknkjkada<br>
62
-
63
- dfgandfsksakfdnvkajn<br>
64
-
65
- </div>
66
-
67
- <a id="modalOpen" class= "modalOpen">問合せ</a>
68
-
69
- </div>
70
-
71
-
72
-
73
- <div class="mask"></div>
74
-
75
-
76
-
77
- </main>
78
-
79
- ```
80
-
81
-
82
-
83
- ```modalscss
84
-
85
- main {
86
-
87
- background-color: rgb(219, 215, 215);
88
-
89
- padding: 20px;
90
-
91
- border-radius: 5px;
92
-
93
- max-width: 1000px;
94
-
95
- margin: 50px auto;
96
-
97
- height: 200vh;
98
-
99
- }
100
-
101
-
102
-
103
- h1 {
104
-
105
- font-size: 30px;
106
-
107
- font-weight: bold;
108
-
109
- margin-bottom: 30px;
110
-
111
- }
112
-
113
-
114
-
115
- .modalOpen, .modalClose {
116
-
117
- display: flex;
118
-
119
- align-items: center;
120
-
121
- justify-content: center;
122
-
123
- width: 200px;
124
-
125
- height: 40px;
126
-
127
- background-color: blue;
128
-
129
- color: white;
130
-
131
- font-size: 16px;
132
-
133
- border-radius: 5px;
134
-
135
- text-decoration: none;
136
-
137
- cursor: pointer;
138
-
139
- }
140
-
141
-
142
-
143
- .modalClose {
144
-
145
- margin: 30px auto 0;
146
-
147
- }
148
-
149
-
150
-
151
- .modal {
152
-
153
- position: fixed;
154
-
155
- top: 50%;
156
-
157
- left: 50%;
158
-
159
- transform: translate(-50%,-50%);
160
-
161
- background-color: rgb(245, 243, 243);
162
-
163
- padding: 20px;
164
-
165
- border-radius:5px;
166
-
167
- min-width: 500px;
168
-
169
- z-index: 2;
170
-
171
- opacity:0;
172
-
173
- visibility: hidden;
174
-
175
- }
176
-
177
-
178
-
179
- .modal h2 {
180
-
181
- font-weight: bold;
182
-
183
- font-size: 20px;
184
-
185
- margin-bottom: 10px;
186
-
187
- }
188
-
189
-
190
-
191
- .modalContents {
192
-
193
- line-height: 1.8;
194
-
195
- }
196
-
197
-
198
-
199
- .mask {
200
-
201
- position: fixed;
202
-
203
- top: 0;
204
-
205
- left: 0;
206
-
207
- width: 100%;
208
-
209
- height: 100%;
210
-
211
- background-color: rgb(5, 3, 3);
212
-
213
- opacity: 0.8;
214
-
215
- z-index: 1;
216
-
217
- opacity: 0;
218
-
219
- visibility: hidden;
220
-
221
- }
222
-
223
- ```
224
-
225
-
226
-
227
- ```modaljs
228
-
229
229
  document.getElementById("modalOpen").addEventListener("click",function(){
230
230
 
231
231
  document.getElementById("modal").classList.add("active");