質問編集履歴
1
補足を致しました><
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
|
24
24
|
|
25
|
-
|
25
|
+
![イメージ説明](f5b5c49b8eb945aeb5c1c585cb65cbdc.png)
|
26
26
|
|
27
27
|
|
28
28
|
|
@@ -81,3 +81,259 @@
|
|
81
81
|
});
|
82
82
|
|
83
83
|
```
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
#補足になります
|
94
|
+
|
95
|
+
サーバーをレンタルしていないので、アップすることができないのですが
|
96
|
+
|
97
|
+
全体のファイルのコードになります><(実際はSCSSで書いていますが、ここに載せるとややこしいので、コンパイル後のCSSを載せております)
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
```HTML
|
104
|
+
|
105
|
+
<!DOCTYPE html>
|
106
|
+
|
107
|
+
<html lang="en">
|
108
|
+
|
109
|
+
<head>
|
110
|
+
|
111
|
+
<meta charset="UTF-8">
|
112
|
+
|
113
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
114
|
+
|
115
|
+
<title>modal_02</title>
|
116
|
+
|
117
|
+
<script src="https://code.jquery.com/jquery-3.5.1.js" integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=" crossorigin="anonymous"></script>
|
118
|
+
|
119
|
+
<link rel="stylesheet" href="./css/style.css">
|
120
|
+
|
121
|
+
<link href="https://use.fontawesome.com/releases/v5.0.8/css/all.css" rel="stylesheet">
|
122
|
+
|
123
|
+
</head>
|
124
|
+
|
125
|
+
<body>
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
<div id="modal" class="modal">
|
130
|
+
|
131
|
+
<div id="modalInner" class="modalInner">
|
132
|
+
|
133
|
+
<img src="./img/img_01.jpg" alt="画像">
|
134
|
+
|
135
|
+
</div>
|
136
|
+
|
137
|
+
<p id="modal_close" class="modal_close">
|
138
|
+
|
139
|
+
<i class="fas fa-times"></i>
|
140
|
+
|
141
|
+
</p>
|
142
|
+
|
143
|
+
<div id="modal_bg" class="modal_bg"></div>
|
144
|
+
|
145
|
+
</div>
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
<p id="modal_open" class="modal_open">画像をみる</p>
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
<script href="js/modal.js"></script>
|
156
|
+
|
157
|
+
</body>
|
158
|
+
|
159
|
+
</html>
|
160
|
+
|
161
|
+
```
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
```CSS
|
168
|
+
|
169
|
+
* {
|
170
|
+
|
171
|
+
margin: 0;
|
172
|
+
|
173
|
+
padding: 0;
|
174
|
+
|
175
|
+
-webkit-box-sizing: border-box;
|
176
|
+
|
177
|
+
box-sizing: border-box;
|
178
|
+
|
179
|
+
}
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
.modal {
|
184
|
+
|
185
|
+
width: 100%;
|
186
|
+
|
187
|
+
height: 100%;
|
188
|
+
|
189
|
+
position: fixed;
|
190
|
+
|
191
|
+
visibility: hidden;
|
192
|
+
|
193
|
+
opacity: 0;
|
194
|
+
|
195
|
+
}
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
.modal.is-show {
|
200
|
+
|
201
|
+
visibility: visible;
|
202
|
+
|
203
|
+
opacity: 1;
|
204
|
+
|
205
|
+
}
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
.modal .modalInner {
|
210
|
+
|
211
|
+
max-width: 700px;
|
212
|
+
|
213
|
+
width: 100%;
|
214
|
+
|
215
|
+
margin: 0 auto;
|
216
|
+
|
217
|
+
background: #fff;
|
218
|
+
|
219
|
+
padding: 20px;
|
220
|
+
|
221
|
+
position: absolute;
|
222
|
+
|
223
|
+
top: 50%;
|
224
|
+
|
225
|
+
left: 50%;
|
226
|
+
|
227
|
+
z-index: 2;
|
228
|
+
|
229
|
+
-webkit-transform: translate(-50%, -50%);
|
230
|
+
|
231
|
+
transform: translate(-50%, -50%);
|
232
|
+
|
233
|
+
}
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
.modal .modalInner img {
|
238
|
+
|
239
|
+
width: 50%;
|
240
|
+
|
241
|
+
margin: 0 auto;
|
242
|
+
|
243
|
+
display: block;
|
244
|
+
|
245
|
+
}
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
.modal .modal_close {
|
250
|
+
|
251
|
+
position: absolute;
|
252
|
+
|
253
|
+
right: 60px;
|
254
|
+
|
255
|
+
top: 120px;
|
256
|
+
|
257
|
+
z-index: 3;
|
258
|
+
|
259
|
+
}
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
.modal .modal_bg {
|
264
|
+
|
265
|
+
width: 100%;
|
266
|
+
|
267
|
+
height: 100%;
|
268
|
+
|
269
|
+
position: absolute;
|
270
|
+
|
271
|
+
background: rgba(0, 0, 0, 0.8);
|
272
|
+
|
273
|
+
top: 0;
|
274
|
+
|
275
|
+
left: 0;
|
276
|
+
|
277
|
+
z-index: 1;
|
278
|
+
|
279
|
+
}
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
.modal_open {
|
284
|
+
|
285
|
+
width: 270px;
|
286
|
+
|
287
|
+
padding: 30px;
|
288
|
+
|
289
|
+
text-align: center;
|
290
|
+
|
291
|
+
background: #000;
|
292
|
+
|
293
|
+
color: #fff;
|
294
|
+
|
295
|
+
margin: 0 auto;
|
296
|
+
|
297
|
+
border-radius: 50px;
|
298
|
+
|
299
|
+
}
|
300
|
+
|
301
|
+
/*# sourceMappingURL=style.css.map */
|
302
|
+
|
303
|
+
```
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
```JS
|
308
|
+
|
309
|
+
'use strict';
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
const modal = document.getElementById('modal');
|
316
|
+
|
317
|
+
const modalInner = document.getElementById('modalInner');
|
318
|
+
|
319
|
+
const close = document.getElementById('modal_close');
|
320
|
+
|
321
|
+
const bg = document.getElementById('modal_bg');
|
322
|
+
|
323
|
+
const show = document.getElementById('modal_open');
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
show.addEventListener('click', () => {
|
330
|
+
|
331
|
+
modal.classList.add('is-show');
|
332
|
+
|
333
|
+
});
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
```
|