回答編集履歴

2

コードも載せた

2019/10/14 02:43

投稿

tanishi_a
tanishi_a

スコア484

test CHANGED
@@ -49,3 +49,303 @@
49
49
  - ハンバーガーメニューは真っ白で表示されない? (全体に背景色が設定してある前提か)
50
50
 
51
51
  - 下の方の関数2つの行頭に、全角空白が入っている (害は無いのかもしれないが)
52
+
53
+
54
+
55
+ ----
56
+
57
+
58
+
59
+ → 訂正。動いた状態の全文。 上記の id="slideShow" は関係なかった。
60
+
61
+
62
+
63
+ ```html
64
+
65
+ <html>
66
+
67
+ <head>
68
+
69
+ <style type="text/css">
70
+
71
+ @media screen and (max-width:768px){
72
+
73
+ .mainnav__items{
74
+
75
+ display: none;
76
+
77
+ }
78
+
79
+
80
+
81
+ .pfix{
82
+
83
+ display: inherit;
84
+
85
+ }
86
+
87
+
88
+
89
+ #target{
90
+
91
+ width: 40px;
92
+
93
+ height: 30px;
94
+
95
+ display: block;
96
+
97
+ position: absolute;
98
+
99
+ top: 35px;
100
+
101
+ left: 84vw;
102
+
103
+ cursor: pointer;
104
+
105
+ transition: 1.5s;
106
+
107
+ }
108
+
109
+
110
+
111
+ .target_inner{
112
+
113
+ width: 40px;
114
+
115
+ height: 30px;
116
+
117
+ position: relative;
118
+
119
+ }
120
+
121
+
122
+
123
+ .target_inner_line{
124
+
125
+ display: block;
126
+
127
+ width: 40px;
128
+
129
+ height: 5px;
130
+
131
+ background: #fff;
132
+
133
+ transition: 1.5s;
134
+
135
+ border-radius: 50px;
136
+
137
+ position: absolute;
138
+
139
+ z-index: 1;
140
+
141
+ }
142
+
143
+
144
+
145
+
146
+
147
+ .target_inner_1{
148
+
149
+ top: 0;
150
+
151
+ }
152
+
153
+
154
+
155
+ .target_inner_2{
156
+
157
+ top: 13px;
158
+
159
+ }
160
+
161
+
162
+
163
+ .target_inner_3{
164
+
165
+ top: 26px;
166
+
167
+ }
168
+
169
+
170
+
171
+ .nav{
172
+
173
+ width: 100%;
174
+
175
+ height: 100vh;
176
+
177
+ position: absolute;
178
+
179
+ z-index: 1;
180
+
181
+ left: -100%;
182
+
183
+ background: rgba(99,99,99,.95);
184
+
185
+ transition: 1.5s;
186
+
187
+ color: white;
188
+
189
+ }
190
+
191
+
192
+
193
+ .nav a{
194
+
195
+ color: white;
196
+
197
+ display: block;
198
+
199
+ text-decoration: none;
200
+
201
+ }
202
+
203
+
204
+
205
+ ul{
206
+
207
+ margin: 0;
208
+
209
+ padding: 0;
210
+
211
+ }
212
+
213
+
214
+
215
+ .nav li{
216
+
217
+ height: calc(100vh/5);
218
+
219
+ line-height: 200px;
220
+
221
+ list-style: none;
222
+
223
+ font-size: 3em;
224
+
225
+ text-align: center;
226
+
227
+ }
228
+
229
+
230
+
231
+ .fadein{
232
+
233
+ left: 0;
234
+
235
+ }
236
+
237
+
238
+
239
+ .linea, .lineb, .linec{
240
+
241
+ background: #ffffff;
242
+
243
+ }
244
+
245
+
246
+
247
+ .linea{
248
+
249
+ transform: rotate(225deg);
250
+
251
+ top: 13px;
252
+
253
+ }
254
+
255
+
256
+
257
+ .lineb{
258
+
259
+ opacity: 0;
260
+
261
+ }
262
+
263
+
264
+
265
+ .linec{
266
+
267
+ transform: rotate(-225deg);
268
+
269
+ top: 13px;
270
+
271
+ }
272
+
273
+ }
274
+
275
+ </style>
276
+
277
+ </head>
278
+
279
+ <body style="background: lightgray">
280
+
281
+ <div class="pfix">
282
+
283
+ <nav class="nav" id="nav_f">
284
+
285
+ <ul>
286
+
287
+ <li><a href="#one" class="list">one</a></li>
288
+
289
+ <li><a href="#two" class="list">two</a></li>
290
+
291
+ <li><a href="#three" class="list">three</a></li>
292
+
293
+ <li><a href="#four" class="list">four</a></li>
294
+
295
+ <li><a href="#five" class="list">five</a></li>
296
+
297
+ </ul>
298
+
299
+ </nav>
300
+
301
+
302
+
303
+ <div id="target">
304
+
305
+ <div class="target_inner">
306
+
307
+ <span class="target_inner_line target_inner_1" id="line1"></span>
308
+
309
+ <span class="target_inner_line target_inner_2" id="line2"></span>
310
+
311
+ <span class="target_inner_line target_inner_3" id="line3"></span>
312
+
313
+ </div>
314
+
315
+ </div>
316
+
317
+ </div>
318
+
319
+
320
+
321
+ <script type="text/javascript">
322
+
323
+ function hamburger() {
324
+
325
+ document.getElementById('line1').classList.toggle('linea');
326
+
327
+ document.getElementById('line2').classList.toggle('lineb');
328
+
329
+ document.getElementById('line3').classList.toggle('linec');
330
+
331
+ document.getElementById('nav_f').classList.toggle('fadein');
332
+
333
+ }
334
+
335
+
336
+
337
+ console.log(document.getElementById('target'));
338
+
339
+ document.getElementById('target').addEventListener('click', function () {
340
+
341
+ hamburger();
342
+
343
+ });
344
+
345
+ </script>
346
+
347
+ </body>
348
+
349
+ </html>
350
+
351
+ ```

1

一部間違えてた

2019/10/14 02:43

投稿

tanishi_a
tanishi_a

スコア484

test CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
  ```html
18
18
 
19
- <nav class="nav" id="nav_f">
19
+ <div class="pfix">
20
20
 
21
21
  ```
22
22