質問編集履歴
2
html,、css、javascriptのコードを貼りました
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
progateの中で、モーダルを表示させる方法を学んでいる時に疑問に思ったことなのですが
|
1
|
+
> 引用テキストprogateの中で、モーダルを表示させる方法を学んでいる時に疑問に思ったことなのですが
|
2
2
|
]
|
3
3
|
この状態のページから右上のログインをクリックし、モーダルを表示させようとした時、
|
4
4
|
このように背景も暗くなります。
|
@@ -6,4 +6,342 @@
|
|
6
6
|
jQueryのコードはこのようになっています。
|
7
7
|
|
8
8
|
自分もこれと同じようにモーダルが表示されるとともに背景の色を暗くしたいと思っています。
|
9
|
-
クリックしてdisplay:none;としていた部分を表示するところまではできるのですが、同時に背景を暗くする方法がわかりません。アドバイスよろしくお願いします。
|
9
|
+
クリックしてdisplay:none;としていた部分を表示するところまではできるのですが、同時に背景を暗くする方法がわかりません。アドバイスよろしくお願いします。
|
10
|
+
コードはこのようになっています
|
11
|
+
|
12
|
+
```html
|
13
|
+
<!DOCTYPE html>
|
14
|
+
<html>
|
15
|
+
<head>
|
16
|
+
<meta charset="utf-8">
|
17
|
+
<title>Progate</title>
|
18
|
+
<link rel="stylesheet" type="text/css" href="stylesheet.css">
|
19
|
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
|
20
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
21
|
+
</head>
|
22
|
+
<body>
|
23
|
+
<header>
|
24
|
+
<div class="container">
|
25
|
+
<div class="header-left">
|
26
|
+
<img class="logo" src="https://prog-8.com/images/html/advanced/main_logo.png">
|
27
|
+
</div>
|
28
|
+
<div class="header-right" >
|
29
|
+
<!-- 以下の<div>タグにlogin-showというidをつけてください -->
|
30
|
+
<div class="login" id="login-show">ログイン</div>
|
31
|
+
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
</header>
|
35
|
+
<div class="signup-modal-wrapper">
|
36
|
+
</div>
|
37
|
+
<!-- 「login-modal」というidを追加してください -->
|
38
|
+
<div class="login-modal-wrapper" id="login-modal">
|
39
|
+
<!-- ログインのモーダル部分のHTMLを貼り付けてください -->
|
40
|
+
|
41
|
+
<div class="modal">
|
42
|
+
<div id="login-form">
|
43
|
+
<h2>Emailログイン</h2>
|
44
|
+
<form action="#">
|
45
|
+
<input class="form-control" type="text" placeholder="メールアドレス">
|
46
|
+
<input class="form-control" type="password" placeholder="パスワード">
|
47
|
+
<div id="submit-btn">ログイン</div>
|
48
|
+
</form>
|
49
|
+
</div>
|
50
|
+
</div>
|
51
|
+
|
52
|
+
</div>
|
53
|
+
<div class="top-wrapper">
|
54
|
+
<div class="container">
|
55
|
+
<h1>LEARN TO CODE.<br>LEARN TO BE CREATIVE.</h1>
|
56
|
+
<p>progateはオンラインプログラミング学習サービスです。<br>初心者にもやさしいスライドとレッスンで、ウェブサービスを作りながらプログラミングを学んでいきましょう。</p>
|
57
|
+
<div class="btn signup">新規登録はこちら</div>
|
58
|
+
<p>or</p>
|
59
|
+
<div class="btn facebook"><span class="fa fa-facebook"></span>Facebookで登録</div>
|
60
|
+
<div class="btn twitter"><span class="fa fa-twitter"></span>Twitterで登録</div>
|
61
|
+
</div>
|
62
|
+
</div>
|
63
|
+
<div class="lesson-wrapper">
|
64
|
+
<div class="container">
|
65
|
+
<div class="heading">
|
66
|
+
<h2>Learn Where to Get Started!</h2>
|
67
|
+
</div>
|
68
|
+
<div class="lessons">
|
69
|
+
</div>
|
70
|
+
</div>
|
71
|
+
</div>
|
72
|
+
<div class="faq-wrapper">
|
73
|
+
<div class="container">
|
74
|
+
<div class="heading">
|
75
|
+
<h2>FAQ</h2>
|
76
|
+
</div>
|
77
|
+
<div class="faq">
|
78
|
+
</div>
|
79
|
+
</div>
|
80
|
+
</div>
|
81
|
+
<div class="message-wrapper">
|
82
|
+
<div class="container">
|
83
|
+
<div class="heading">
|
84
|
+
<h2>さぁ、あなたもProgateでプログラミングを学んでみませんか?</h2>
|
85
|
+
<h3 id="tagline">Let's learn to code, learn to be creative!</h3>
|
86
|
+
</div>
|
87
|
+
<div class="btn message">さっそく開発する</div>
|
88
|
+
</div>
|
89
|
+
</div>
|
90
|
+
<footer>
|
91
|
+
<div class="container">
|
92
|
+
<img src="https://prog-8.com/images/html/advanced/footer_logo.png">
|
93
|
+
<p>Learn to Code,Learn to be Creative.</p>
|
94
|
+
</div>
|
95
|
+
</footer>
|
96
|
+
<script src="script.js"></script>
|
97
|
+
</body>
|
98
|
+
</html>
|
99
|
+
```
|
100
|
+
|
101
|
+
```css
|
102
|
+
body {
|
103
|
+
margin: 0;
|
104
|
+
}
|
105
|
+
|
106
|
+
a {
|
107
|
+
text-decoration: none;
|
108
|
+
}
|
109
|
+
|
110
|
+
.top-wrapper {
|
111
|
+
padding: 180px 0 100px 0;
|
112
|
+
background-image: url(https://prog-8.com/images/html/advanced/top.png);
|
113
|
+
background-size: cover;
|
114
|
+
color: white;
|
115
|
+
text-align: center;
|
116
|
+
}
|
117
|
+
|
118
|
+
.container {
|
119
|
+
width: 1170px;
|
120
|
+
padding: 0 15px;
|
121
|
+
margin: 0 auto;
|
122
|
+
}
|
123
|
+
|
124
|
+
.top-wrapper h1 {
|
125
|
+
opacity: 0.7;
|
126
|
+
font-size: 45px;
|
127
|
+
letter-spacing: 5px;
|
128
|
+
}
|
129
|
+
|
130
|
+
.top-wrapper p {
|
131
|
+
opacity: 0.7;
|
132
|
+
font-size: 14px;
|
133
|
+
margin-bottom: 35px;
|
134
|
+
}
|
135
|
+
|
136
|
+
.signup {
|
137
|
+
background-color: #239b76;
|
138
|
+
}
|
139
|
+
|
140
|
+
.facebook {
|
141
|
+
background-color: #3b5998;
|
142
|
+
margin-right: 10px;
|
143
|
+
}
|
144
|
+
|
145
|
+
.twitter {
|
146
|
+
background-color: #55acee;
|
147
|
+
}
|
148
|
+
|
149
|
+
.btn {
|
150
|
+
padding: 8px 24px;
|
151
|
+
color: white;
|
152
|
+
display: inline-block;
|
153
|
+
opacity: 0.8;
|
154
|
+
border-radius: 4px;
|
155
|
+
cursor: pointer;
|
156
|
+
}
|
157
|
+
|
158
|
+
.btn:hover {
|
159
|
+
opacity: 1;
|
160
|
+
}
|
161
|
+
|
162
|
+
.fa {
|
163
|
+
margin-right: 5px;
|
164
|
+
}
|
165
|
+
|
166
|
+
header {
|
167
|
+
height: 65px;
|
168
|
+
width: 100%;
|
169
|
+
background-color: rgba(34,49,52,0.9);
|
170
|
+
position :fixed;
|
171
|
+
top: 0;
|
172
|
+
z-index: 10;
|
173
|
+
}
|
174
|
+
|
175
|
+
.logo {
|
176
|
+
width: 124px;
|
177
|
+
margin-top: 20px;
|
178
|
+
}
|
179
|
+
|
180
|
+
.header-left {
|
181
|
+
float: left;
|
182
|
+
}
|
183
|
+
|
184
|
+
.header-right {
|
185
|
+
float: right;
|
186
|
+
background-color: rgba(255,255,255,0.3);
|
187
|
+
transition: all 0.5s;
|
188
|
+
}
|
189
|
+
|
190
|
+
.header-right:hover {
|
191
|
+
background-color: rgba(255,255,255,0.5);
|
192
|
+
}
|
193
|
+
|
194
|
+
.header-right .login {
|
195
|
+
line-height: 65px;
|
196
|
+
padding: 0 25px;
|
197
|
+
color: white;
|
198
|
+
cursor: pointer;
|
199
|
+
display: block;
|
200
|
+
}
|
201
|
+
|
202
|
+
/*モーダル*/
|
203
|
+
/* モーダル部分のCSSを貼り付けてください */
|
204
|
+
.login-modal-wrapper {
|
205
|
+
display: none;
|
206
|
+
position: fixed;
|
207
|
+
top: 0;
|
208
|
+
right: 0;
|
209
|
+
bottom: 0;
|
210
|
+
left: 0;
|
211
|
+
background-color: rgba(0, 0, 0, 0.5);
|
212
|
+
z-index: 100;
|
213
|
+
/* display: none;を追加してください */
|
214
|
+
|
215
|
+
}
|
216
|
+
|
217
|
+
.modal {
|
218
|
+
position: absolute;
|
219
|
+
top: 20%;
|
220
|
+
left: 34%;
|
221
|
+
background-color: #e6ecf0;
|
222
|
+
padding: 20px 0 40px;
|
223
|
+
border-radius: 10px;
|
224
|
+
width: 450px;
|
225
|
+
height: auto;
|
226
|
+
text-align: center;
|
227
|
+
}
|
228
|
+
|
229
|
+
.fa-times {
|
230
|
+
position: absolute;
|
231
|
+
top: 12px;
|
232
|
+
right: 12px;
|
233
|
+
color: rgba(128, 128, 128, 0.46);
|
234
|
+
cursor: pointer;
|
235
|
+
}
|
236
|
+
|
237
|
+
#signup-form, #login-form {
|
238
|
+
width: 100%;
|
239
|
+
}
|
240
|
+
|
241
|
+
#signup-form h2, #login-form h2 {
|
242
|
+
color: #5f5d60;
|
243
|
+
letter-spacing: 1px;
|
244
|
+
margin-bottom: 40px;
|
245
|
+
}
|
246
|
+
|
247
|
+
#signup-form input, #login-form input {
|
248
|
+
width: 320px;
|
249
|
+
margin-bottom: 20px;
|
250
|
+
font-size: 12px;
|
251
|
+
padding: 12px 12px;
|
252
|
+
border: 1px solid #d0d5d8;
|
253
|
+
border-radius: 5px;
|
254
|
+
}
|
255
|
+
|
256
|
+
#submit-btn {
|
257
|
+
display: inline-block;
|
258
|
+
padding: 14px 140px;
|
259
|
+
background-color: #5dca88;
|
260
|
+
border: none;
|
261
|
+
border-radius: 3px;
|
262
|
+
color: white;
|
263
|
+
margin: 10px auto;
|
264
|
+
cursor: pointer;
|
265
|
+
}
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
.lesson-wrapper {
|
270
|
+
height: 500px;
|
271
|
+
padding-bottom: 80px;
|
272
|
+
background-color: #f7f7f7;
|
273
|
+
text-align: center;
|
274
|
+
}
|
275
|
+
|
276
|
+
.heading {
|
277
|
+
padding-top: 60px;
|
278
|
+
padding-bottom: 30px;
|
279
|
+
color: #5f5d60;
|
280
|
+
}
|
281
|
+
|
282
|
+
.heading h2 {
|
283
|
+
font-weight: normal;
|
284
|
+
}
|
285
|
+
|
286
|
+
/*faq wrapper*/
|
287
|
+
.faq-wrapper {
|
288
|
+
background-color: #e6ecf0;
|
289
|
+
text-align: center;
|
290
|
+
padding-bottom: 80px;
|
291
|
+
color: #5f5d60;
|
292
|
+
}
|
293
|
+
|
294
|
+
#faq-list {
|
295
|
+
width: 500px;
|
296
|
+
margin: 0 auto;
|
297
|
+
padding: 0;
|
298
|
+
list-style: none;
|
299
|
+
}
|
300
|
+
|
301
|
+
.message-wrapper {
|
302
|
+
border-bottom: 1px solid #eee;
|
303
|
+
padding-bottom: 80px;
|
304
|
+
text-align: center;
|
305
|
+
}
|
306
|
+
|
307
|
+
.message-wrapper .heading h3 {
|
308
|
+
font-weight: normal;
|
309
|
+
}
|
310
|
+
|
311
|
+
.message {
|
312
|
+
padding: 15px 40px;
|
313
|
+
background-color: #5dca88;
|
314
|
+
cursor: pointer;
|
315
|
+
box-shadow: 0px 7px #1a7940;
|
316
|
+
}
|
317
|
+
|
318
|
+
.message:active {
|
319
|
+
position: relative;
|
320
|
+
top: 7px;
|
321
|
+
box-shadow: none;
|
322
|
+
}
|
323
|
+
|
324
|
+
footer img {
|
325
|
+
width: 125px;
|
326
|
+
}
|
327
|
+
|
328
|
+
footer p {
|
329
|
+
color: #b3aeb5;
|
330
|
+
font-size: 12px;
|
331
|
+
}
|
332
|
+
|
333
|
+
footer {
|
334
|
+
padding-top: 30px;
|
335
|
+
}
|
336
|
+
|
337
|
+
```
|
338
|
+
|
339
|
+
```js
|
340
|
+
$(function() {
|
341
|
+
// 「#login-show」要素に対するclickイベントを作成してください
|
342
|
+
$('#login-show').click(function(){
|
343
|
+
$('#login-modal').fadeIn();
|
344
|
+
});
|
345
|
+
|
346
|
+
});
|
347
|
+
```
|
1
タイトルの修正
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
jQueryでモーダルを表示した際の背景の色が変わる
|
1
|
+
jQueryでモーダルを表示した際の背景の色が変わる方法
|
body
CHANGED
File without changes
|