質問編集履歴

2

html,、css、javascriptのコードを貼りました

2019/06/17 01:43

投稿

lilbear
lilbear

スコア19

test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,4 @@
1
- progateの中で、モーダルを表示させる方法を学んでいる時に疑問に思ったことなのですが
1
+ > 引用テキストprogateの中で、モーダルを表示させる方法を学んでいる時に疑問に思ったことなのですが
2
2
 
3
3
  ![![イメージ説明](02b0bc89bd25d136b9da8f54bd991374.png)]
4
4
 
@@ -15,3 +15,679 @@
15
15
  自分もこれと同じようにモーダルが表示されるとともに背景の色を暗くしたいと思っています。
16
16
 
17
17
  クリックしてdisplay:none;としていた部分を表示するところまではできるのですが、同時に背景を暗くする方法がわかりません。アドバイスよろしくお願いします。
18
+
19
+ コードはこのようになっています
20
+
21
+
22
+
23
+ ```html
24
+
25
+ <!DOCTYPE html>
26
+
27
+ <html>
28
+
29
+ <head>
30
+
31
+ <meta charset="utf-8">
32
+
33
+ <title>Progate</title>
34
+
35
+ <link rel="stylesheet" type="text/css" href="stylesheet.css">
36
+
37
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
38
+
39
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
40
+
41
+ </head>
42
+
43
+ <body>
44
+
45
+ <header>
46
+
47
+ <div class="container">
48
+
49
+ <div class="header-left">
50
+
51
+ <img class="logo" src="https://prog-8.com/images/html/advanced/main_logo.png">
52
+
53
+ </div>
54
+
55
+ <div class="header-right" >
56
+
57
+ <!-- 以下の<div>タグにlogin-showというidをつけてください -->
58
+
59
+ <div class="login" id="login-show">ログイン</div>
60
+
61
+
62
+
63
+ </div>
64
+
65
+ </div>
66
+
67
+ </header>
68
+
69
+ <div class="signup-modal-wrapper">
70
+
71
+ </div>
72
+
73
+ <!-- 「login-modal」というidを追加してください -->
74
+
75
+ <div class="login-modal-wrapper" id="login-modal">
76
+
77
+ <!-- ログインのモーダル部分のHTMLを貼り付けてください -->
78
+
79
+
80
+
81
+ <div class="modal">
82
+
83
+ <div id="login-form">
84
+
85
+ <h2>Emailログイン</h2>
86
+
87
+ <form action="#">
88
+
89
+ <input class="form-control" type="text" placeholder="メールアドレス">
90
+
91
+ <input class="form-control" type="password" placeholder="パスワード">
92
+
93
+ <div id="submit-btn">ログイン</div>
94
+
95
+ </form>
96
+
97
+ </div>
98
+
99
+ </div>
100
+
101
+
102
+
103
+ </div>
104
+
105
+ <div class="top-wrapper">
106
+
107
+ <div class="container">
108
+
109
+ <h1>LEARN TO CODE.<br>LEARN TO BE CREATIVE.</h1>
110
+
111
+ <p>progateはオンラインプログラミング学習サービスです。<br>初心者にもやさしいスライドとレッスンで、ウェブサービスを作りながらプログラミングを学んでいきましょう。</p>
112
+
113
+ <div class="btn signup">新規登録はこちら</div>
114
+
115
+ <p>or</p>
116
+
117
+ <div class="btn facebook"><span class="fa fa-facebook"></span>Facebookで登録</div>
118
+
119
+ <div class="btn twitter"><span class="fa fa-twitter"></span>Twitterで登録</div>
120
+
121
+ </div>
122
+
123
+ </div>
124
+
125
+ <div class="lesson-wrapper">
126
+
127
+ <div class="container">
128
+
129
+ <div class="heading">
130
+
131
+ <h2>Learn Where to Get Started!</h2>
132
+
133
+ </div>
134
+
135
+ <div class="lessons">
136
+
137
+ </div>
138
+
139
+ </div>
140
+
141
+ </div>
142
+
143
+ <div class="faq-wrapper">
144
+
145
+ <div class="container">
146
+
147
+ <div class="heading">
148
+
149
+ <h2>FAQ</h2>
150
+
151
+ </div>
152
+
153
+ <div class="faq">
154
+
155
+ </div>
156
+
157
+ </div>
158
+
159
+ </div>
160
+
161
+ <div class="message-wrapper">
162
+
163
+ <div class="container">
164
+
165
+ <div class="heading">
166
+
167
+ <h2>さぁ、あなたもProgateでプログラミングを学んでみませんか?</h2>
168
+
169
+ <h3 id="tagline">Let's learn to code, learn to be creative!</h3>
170
+
171
+ </div>
172
+
173
+ <div class="btn message">さっそく開発する</div>
174
+
175
+ </div>
176
+
177
+ </div>
178
+
179
+ <footer>
180
+
181
+ <div class="container">
182
+
183
+ <img src="https://prog-8.com/images/html/advanced/footer_logo.png">
184
+
185
+ <p>Learn to Code,Learn to be Creative.</p>
186
+
187
+ </div>
188
+
189
+ </footer>
190
+
191
+ <script src="script.js"></script>
192
+
193
+ </body>
194
+
195
+ </html>
196
+
197
+ ```
198
+
199
+
200
+
201
+ ```css
202
+
203
+ body {
204
+
205
+ margin: 0;
206
+
207
+ }
208
+
209
+
210
+
211
+ a {
212
+
213
+ text-decoration: none;
214
+
215
+ }
216
+
217
+
218
+
219
+ .top-wrapper {
220
+
221
+ padding: 180px 0 100px 0;
222
+
223
+ background-image: url(https://prog-8.com/images/html/advanced/top.png);
224
+
225
+ background-size: cover;
226
+
227
+ color: white;
228
+
229
+ text-align: center;
230
+
231
+ }
232
+
233
+
234
+
235
+ .container {
236
+
237
+ width: 1170px;
238
+
239
+ padding: 0 15px;
240
+
241
+ margin: 0 auto;
242
+
243
+ }
244
+
245
+
246
+
247
+ .top-wrapper h1 {
248
+
249
+ opacity: 0.7;
250
+
251
+ font-size: 45px;
252
+
253
+ letter-spacing: 5px;
254
+
255
+ }
256
+
257
+
258
+
259
+ .top-wrapper p {
260
+
261
+ opacity: 0.7;
262
+
263
+ font-size: 14px;
264
+
265
+ margin-bottom: 35px;
266
+
267
+ }
268
+
269
+
270
+
271
+ .signup {
272
+
273
+ background-color: #239b76;
274
+
275
+ }
276
+
277
+
278
+
279
+ .facebook {
280
+
281
+ background-color: #3b5998;
282
+
283
+ margin-right: 10px;
284
+
285
+ }
286
+
287
+
288
+
289
+ .twitter {
290
+
291
+ background-color: #55acee;
292
+
293
+ }
294
+
295
+
296
+
297
+ .btn {
298
+
299
+ padding: 8px 24px;
300
+
301
+ color: white;
302
+
303
+ display: inline-block;
304
+
305
+ opacity: 0.8;
306
+
307
+ border-radius: 4px;
308
+
309
+ cursor: pointer;
310
+
311
+ }
312
+
313
+
314
+
315
+ .btn:hover {
316
+
317
+ opacity: 1;
318
+
319
+ }
320
+
321
+
322
+
323
+ .fa {
324
+
325
+ margin-right: 5px;
326
+
327
+ }
328
+
329
+
330
+
331
+ header {
332
+
333
+ height: 65px;
334
+
335
+ width: 100%;
336
+
337
+ background-color: rgba(34,49,52,0.9);
338
+
339
+ position :fixed;
340
+
341
+ top: 0;
342
+
343
+ z-index: 10;
344
+
345
+ }
346
+
347
+
348
+
349
+ .logo {
350
+
351
+ width: 124px;
352
+
353
+ margin-top: 20px;
354
+
355
+ }
356
+
357
+
358
+
359
+ .header-left {
360
+
361
+ float: left;
362
+
363
+ }
364
+
365
+
366
+
367
+ .header-right {
368
+
369
+ float: right;
370
+
371
+ background-color: rgba(255,255,255,0.3);
372
+
373
+ transition: all 0.5s;
374
+
375
+ }
376
+
377
+
378
+
379
+ .header-right:hover {
380
+
381
+ background-color: rgba(255,255,255,0.5);
382
+
383
+ }
384
+
385
+
386
+
387
+ .header-right .login {
388
+
389
+ line-height: 65px;
390
+
391
+ padding: 0 25px;
392
+
393
+ color: white;
394
+
395
+ cursor: pointer;
396
+
397
+ display: block;
398
+
399
+ }
400
+
401
+
402
+
403
+ /*モーダル*/
404
+
405
+ /* モーダル部分のCSSを貼り付けてください */
406
+
407
+ .login-modal-wrapper {
408
+
409
+ display: none;
410
+
411
+ position: fixed;
412
+
413
+ top: 0;
414
+
415
+ right: 0;
416
+
417
+ bottom: 0;
418
+
419
+ left: 0;
420
+
421
+ background-color: rgba(0, 0, 0, 0.5);
422
+
423
+ z-index: 100;
424
+
425
+ /* display: none;を追加してください */
426
+
427
+
428
+
429
+ }
430
+
431
+
432
+
433
+ .modal {
434
+
435
+ position: absolute;
436
+
437
+ top: 20%;
438
+
439
+ left: 34%;
440
+
441
+ background-color: #e6ecf0;
442
+
443
+ padding: 20px 0 40px;
444
+
445
+ border-radius: 10px;
446
+
447
+ width: 450px;
448
+
449
+ height: auto;
450
+
451
+ text-align: center;
452
+
453
+ }
454
+
455
+
456
+
457
+ .fa-times {
458
+
459
+ position: absolute;
460
+
461
+ top: 12px;
462
+
463
+ right: 12px;
464
+
465
+ color: rgba(128, 128, 128, 0.46);
466
+
467
+ cursor: pointer;
468
+
469
+ }
470
+
471
+
472
+
473
+ #signup-form, #login-form {
474
+
475
+ width: 100%;
476
+
477
+ }
478
+
479
+
480
+
481
+ #signup-form h2, #login-form h2 {
482
+
483
+ color: #5f5d60;
484
+
485
+ letter-spacing: 1px;
486
+
487
+ margin-bottom: 40px;
488
+
489
+ }
490
+
491
+
492
+
493
+ #signup-form input, #login-form input {
494
+
495
+ width: 320px;
496
+
497
+ margin-bottom: 20px;
498
+
499
+ font-size: 12px;
500
+
501
+ padding: 12px 12px;
502
+
503
+ border: 1px solid #d0d5d8;
504
+
505
+ border-radius: 5px;
506
+
507
+ }
508
+
509
+
510
+
511
+ #submit-btn {
512
+
513
+ display: inline-block;
514
+
515
+ padding: 14px 140px;
516
+
517
+ background-color: #5dca88;
518
+
519
+ border: none;
520
+
521
+ border-radius: 3px;
522
+
523
+ color: white;
524
+
525
+ margin: 10px auto;
526
+
527
+ cursor: pointer;
528
+
529
+ }
530
+
531
+
532
+
533
+
534
+
535
+
536
+
537
+ .lesson-wrapper {
538
+
539
+ height: 500px;
540
+
541
+ padding-bottom: 80px;
542
+
543
+ background-color: #f7f7f7;
544
+
545
+ text-align: center;
546
+
547
+ }
548
+
549
+
550
+
551
+ .heading {
552
+
553
+ padding-top: 60px;
554
+
555
+ padding-bottom: 30px;
556
+
557
+ color: #5f5d60;
558
+
559
+ }
560
+
561
+
562
+
563
+ .heading h2 {
564
+
565
+ font-weight: normal;
566
+
567
+ }
568
+
569
+
570
+
571
+ /*faq wrapper*/
572
+
573
+ .faq-wrapper {
574
+
575
+ background-color: #e6ecf0;
576
+
577
+ text-align: center;
578
+
579
+ padding-bottom: 80px;
580
+
581
+ color: #5f5d60;
582
+
583
+ }
584
+
585
+
586
+
587
+ #faq-list {
588
+
589
+ width: 500px;
590
+
591
+ margin: 0 auto;
592
+
593
+ padding: 0;
594
+
595
+ list-style: none;
596
+
597
+ }
598
+
599
+
600
+
601
+ .message-wrapper {
602
+
603
+ border-bottom: 1px solid #eee;
604
+
605
+ padding-bottom: 80px;
606
+
607
+ text-align: center;
608
+
609
+ }
610
+
611
+
612
+
613
+ .message-wrapper .heading h3 {
614
+
615
+ font-weight: normal;
616
+
617
+ }
618
+
619
+
620
+
621
+ .message {
622
+
623
+ padding: 15px 40px;
624
+
625
+ background-color: #5dca88;
626
+
627
+ cursor: pointer;
628
+
629
+ box-shadow: 0px 7px #1a7940;
630
+
631
+ }
632
+
633
+
634
+
635
+ .message:active {
636
+
637
+ position: relative;
638
+
639
+ top: 7px;
640
+
641
+ box-shadow: none;
642
+
643
+ }
644
+
645
+
646
+
647
+ footer img {
648
+
649
+ width: 125px;
650
+
651
+ }
652
+
653
+
654
+
655
+ footer p {
656
+
657
+ color: #b3aeb5;
658
+
659
+ font-size: 12px;
660
+
661
+ }
662
+
663
+
664
+
665
+ footer {
666
+
667
+ padding-top: 30px;
668
+
669
+ }
670
+
671
+
672
+
673
+ ```
674
+
675
+
676
+
677
+ ```js
678
+
679
+ $(function() {
680
+
681
+ // 「#login-show」要素に対するclickイベントを作成してください
682
+
683
+ $('#login-show').click(function(){
684
+
685
+ $('#login-modal').fadeIn();
686
+
687
+ });
688
+
689
+
690
+
691
+ });
692
+
693
+ ```

1

タイトルの修正

2019/06/17 01:43

投稿

lilbear
lilbear

スコア19

test CHANGED
@@ -1 +1 @@
1
- jQueryでモーダルを表示した際の背景の色が変わる理由
1
+ jQueryでモーダルを表示した際の背景の色が変わる方法
test CHANGED
File without changes