質問編集履歴

2

ソースを修正

2020/10/19 11:40

投稿

Nicole0518
Nicole0518

スコア1

test CHANGED
File without changes
test CHANGED
@@ -56,7 +56,7 @@
56
56
 
57
57
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
58
58
 
59
- <title>POKET STAR</title>
59
+ <title>dummy</title>
60
60
 
61
61
  <link rel="stylesheet" type="text/css" href="stylesheets/style.css">
62
62
 

1

ソースの追加

2020/10/19 11:40

投稿

Nicole0518
Nicole0518

スコア1

test CHANGED
File without changes
test CHANGED
@@ -44,31 +44,113 @@
44
44
 
45
45
 
46
46
 
47
+ ```html
48
+
49
+ <!DOCTYPE html>
50
+
51
+ <html lang="ja">
52
+
53
+ <head>
54
+
55
+ <meta charset="UTF-8">
56
+
57
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
58
+
47
- -----------------HTMLソース---------------------------
59
+ <title>POKET STAR</title>
60
+
48
-
61
+ <link rel="stylesheet" type="text/css" href="stylesheets/style.css">
62
+
63
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
64
+
65
+ <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
66
+
67
+
68
+
69
+ </head>
70
+
49
- <body>
71
+ <body>
72
+
73
+
74
+
50
-
75
+ <!-- ボタン -->
76
+
77
+ <div class="btn", id="btn">
78
+
79
+ <p>モーダルウィンドウ</p>
80
+
51
- ~省略~
81
+ </div>
82
+
83
+
84
+
52
-
85
+ <!-- モーダルウィンドウ結果表示 -->
86
+
53
- <div class="popup" id="js-popup-result">
87
+ <div class="popup" id="js-popup-result">
54
88
 
55
89
  <div class="popup-inner-result" id="popup-inner-result">
56
90
 
57
- ~省略~
58
-
59
-    </div>
60
-
61
- </div>
62
-
63
-
64
-
65
- </body>
66
-
67
-
68
-
69
-
70
-
71
- --------------------CSSソース-------------------------
91
+ <!-- コンテンツ -->
92
+
93
+ <div id="contents">
94
+
95
+ </div>
96
+
97
+ </div>
98
+
99
+ <div class="black-background" id="js-black-bg-result"><div class="close-btn" id="js-close-btn-result"><div class="close-1"><div class="close-2"><i class="fas fa-times"></i></div></div></div></div>
100
+
101
+ </div>
102
+
103
+
104
+
105
+ <!-- Optional JavaScript -->
106
+
107
+ <script src="javascripts/script.js"></script>
108
+
109
+
110
+
111
+ </body>
112
+
113
+
114
+
115
+ </html>
116
+
117
+
118
+
119
+ ```
120
+
121
+
122
+
123
+ ```css
124
+
125
+
126
+
127
+ .btn{
128
+
129
+ background-color: green;
130
+
131
+ width:100px;
132
+
133
+ height:100px;
134
+
135
+
136
+
137
+ font-weight: bold;
138
+
139
+ }
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+ /**************************************
150
+
151
+ * モーダルウィンドウ
152
+
153
+ **************************************/
72
154
 
73
155
 
74
156
 
@@ -94,6 +176,14 @@
94
176
 
95
177
  }
96
178
 
179
+ .popup.is-show {
180
+
181
+ opacity: 1;
182
+
183
+ visibility: visible;
184
+
185
+ }
186
+
97
187
 
98
188
 
99
189
  .popup-inner-result {
@@ -112,7 +202,7 @@
112
202
 
113
203
  background-color: white;
114
204
 
115
- z-index: 2;
205
+ z-index: 10000;
116
206
 
117
207
 
118
208
 
@@ -120,8 +210,334 @@
120
210
 
121
211
 
122
212
 
213
+ -webkit-overflow-scrolling: touch;
214
+
215
+ max-height: 100vh;
216
+
217
+
218
+
123
- }
219
+ }
220
+
221
+
222
+
223
+
224
+
124
-
225
+ @media(max-width: 600px) {
226
+
227
+
228
+
125
-
229
+ .popup-inner-result {
230
+
126
-
231
+ overflow-y: scroll;
232
+
233
+ position: absolute;
234
+
235
+ left: 50%;
236
+
237
+ top: 50%;
238
+
239
+ transform: translate(-50%,-50%);
240
+
241
+ padding: 5%;
242
+
243
+ background-color: white;
244
+
245
+ z-index: 2;
246
+
247
+
248
+
249
+ border-radius: 3rem;
250
+
251
+
252
+
253
+ -webkit-overflow-scrolling: touch;
254
+
255
+ max-height: 100vh;
256
+
257
+
258
+
259
+ }
260
+
261
+ }
262
+
263
+
264
+
265
+ .close-btn {
266
+
267
+ position: absolute;
268
+
269
+ right: 2%;
270
+
271
+ top: 2%;
272
+
273
+ width: 50px;
274
+
275
+ height: 50px;
276
+
277
+ line-height: 50px;
278
+
279
+ text-align: center;
280
+
281
+ cursor: pointer;
282
+
283
+ /*background-color: green;*/
284
+
285
+ border-radius: 100%;
286
+
287
+ font-size: 100%;
288
+
289
+ }
290
+
291
+
292
+
293
+ .close-1{
294
+
295
+ height: 30px;
296
+
297
+ width: 4px;
298
+
299
+ margin-left: 23px;
300
+
301
+ background-color: white;
302
+
303
+ transform: rotate(45deg);
304
+
305
+ Z-index:1;
306
+
307
+ }
308
+
309
+
310
+
311
+ .close-2{
312
+
313
+ height: 30px;
314
+
315
+ width: 4px;
316
+
317
+ background-color: white;
318
+
319
+ transform: rotate(90deg);
320
+
321
+ Z-index:2;
322
+
323
+ }
324
+
325
+
326
+
327
+
328
+
329
+ @media(max-width: 600px) {
330
+
331
+ .close-btn {
332
+
333
+ width: 30px;
334
+
335
+ height: 30px;
336
+
337
+ }
338
+
339
+
340
+
341
+ .close-1{
342
+
343
+ height: 30px;
344
+
345
+ width: 2.5px;
346
+
347
+ margin-left: 14px;
348
+
349
+ }
350
+
351
+
352
+
353
+ .close-2{
354
+
355
+ height: 30px;
356
+
357
+ width: 2.5px;
358
+
359
+ }
360
+
361
+ }
362
+
363
+
364
+
365
+
366
+
367
+ .close-btn i {
368
+
369
+ font-size: 50px;
370
+
371
+ color: #39a9d6;
372
+
373
+ }
374
+
375
+ .black-background {
376
+
377
+ position: absolute;
378
+
379
+ left: 0;
380
+
381
+ top: 0;
382
+
383
+ width: 100%;
384
+
385
+ height: 100%;
386
+
387
+ background-color: rgba(0,0,0,.8);
388
+
389
+ z-index: 1;
390
+
391
+ }
392
+
393
+
394
+
395
+ ```
396
+
397
+
398
+
399
+ ```javascript
400
+
401
+
402
+
403
+ var btn = document.getElementById("btn");
404
+
405
+ var popupwindowResult = document.getElementById("popup-inner-result");
406
+
407
+
408
+
409
+
410
+
411
+ btn.addEventListener('click', function() {
412
+
413
+
414
+
415
+ showResultModal();
416
+
417
+
418
+
419
+ })
420
+
421
+
422
+
423
+ /***************************************************************
424
+
425
+ * 画面初期ロード時
426
+
427
+ ****************************************************************/
428
+
429
+ window.onload = function(){
430
+
431
+
432
+
433
+ var sW,sH;
434
+
435
+ var width,height;
436
+
437
+
438
+
439
+ sW = window.innerWidth
440
+
441
+ sH = window.innerHeight;
442
+
443
+
444
+
445
+ //PC画面(横長の場合)
446
+
447
+ if(sW >= sH){
448
+
449
+ width = sW*0.5;
450
+
451
+ height =sH*0.65;
452
+
453
+
454
+
455
+ }else{
456
+
457
+ width = sW*0.6;
458
+
459
+ height =sH*0.7;
460
+
461
+ }
462
+
463
+
464
+
465
+ /* ポップアップウィンドウ(結果表示) */
466
+
467
+ if(popupwindowResult != null){
468
+
127
- --------------------------------------------------------
469
+ popupwindowResult.style.width = width*1.3 + "px";
470
+
471
+ popupwindowResult.style.height = height*1.1 + "px";
472
+
473
+ }else{
474
+
475
+ console.log("ERROR:popupwindowResult is null, Function:window.onload");
476
+
477
+ }
478
+
479
+
480
+
481
+ var table = "";
482
+
483
+ var contents = document.getElementById("contents");
484
+
485
+
486
+
487
+ for(var i = 0; i < 20; i++){
488
+
489
+ table = table + "<p>ダミー</p><br>";
490
+
491
+ }
492
+
493
+
494
+
495
+ contents.innerHTML += table;
496
+
497
+
498
+
499
+ }
500
+
501
+
502
+
503
+ /*******************************************
504
+
505
+ *    結果モーダルウィンドウ表示
506
+
507
+ *******************************************/
508
+
509
+ function showResultModal(){
510
+
511
+ var popup = document.getElementById('js-popup-result');
512
+
513
+ if(!popup) return;
514
+
515
+ popup.classList.add('is-show');
516
+
517
+
518
+
519
+ var closeBtn = document.getElementById('js-close-btn-result');
520
+
521
+
522
+
523
+ closePopUp(closeBtn);
524
+
525
+
526
+
527
+ function closePopUp(elem) {
528
+
529
+ if(!elem) return;
530
+
531
+ elem.addEventListener('click', function() {
532
+
533
+ popup.classList.remove('is-show');
534
+
535
+ })
536
+
537
+ }
538
+
539
+ }
540
+
541
+
542
+
543
+ ```