質問編集履歴

4

修正しました。

2021/11/05 11:42

投稿

free_teku
free_teku

スコア103

test CHANGED
File without changes
test CHANGED
@@ -76,103 +76,7 @@
76
76
 
77
77
 
78
78
 
79
- ```HTML
80
79
 
81
- <!DOCTYPE html>
82
-
83
- <html lang="jp">
84
-
85
- <head>
86
-
87
- <meta charset="UTF-8">
88
-
89
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
90
-
91
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
92
-
93
- <title>石井</title>
94
-
95
- <meta name="description" content="おすすめ教材">
96
-
97
- <link rel="stylesheet" href="./css/destyle.css">
98
-
99
- <link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
100
-
101
- <link rel="stylesheet" href="./css/style.css">
102
-
103
- </head>
104
-
105
- <body>
106
-
107
- <header class="header">
108
-
109
- <div class="header-inner">
110
-
111
- <div class="header-left">
112
-
113
- <h1 class="logo">
114
-
115
- <a href="#">
116
-
117
- <img class="header-logo" src="/img/top-header-logo.png" alt="">
118
-
119
- </a>
120
-
121
- </h1>
122
-
123
-
124
-
125
- <nav class="nav nav-open drawer-nav">
126
-
127
- <ul class="header-list">
128
-
129
- <li class="header-item"> <a href="./Room/room.html">お部屋</a></li><!-- /.header-item -->
130
-
131
- <li class="header-item"> <a href="./Menu/menu.html">お料理</a></li><!-- /.header-item -->
132
-
133
- <li class="header-item"> <a href="./Onsen/onsen.html">温泉</a></li><!-- /.header-item -->
134
-
135
- </ul><!-- /.header-list -->
136
-
137
- </nav><!-- /.nav -->
138
-
139
-
140
-
141
- </div>
142
-
143
- <div class="header-right">
144
-
145
- <div class="header-link " id="js-modal">
146
-
147
- <a class="calender-link js-modal-open" href="#">
148
-
149
- <!-- <img src="./img/calender.png" alt="カレンダー"> -->
150
-
151
- 宿泊予約
152
-
153
- </a>
154
-
155
- </div><!-- /.header-link -->
156
-
157
-
158
-
159
- <button type="button" id="js-humburger" class=" humburger" aria-controls="js-glabal-menu" aria-expanded="false" area-label="メニューを開閉する">
160
-
161
- <span class="line"></span ><span class="line"></span><span class="line"></span>
162
-
163
- </button>
164
-
165
- </div><!-- /.header-right -->
166
-
167
- </div><!-- /.header-inner -->
168
-
169
- </header><!-- /.header -->
170
-
171
- <div class="overlay"></div><!-- /.overlay -->
172
-
173
- </body>
174
-
175
- </html>
176
80
 
177
81
 
178
82
 
@@ -181,6 +85,78 @@
181
85
 
182
86
 
183
87
  [コード](https://jsfiddle.net/take0844/zk5sh2wn/5/)
88
+
89
+
90
+
91
+ ### 追記 js
92
+
93
+ ```js
94
+
95
+
96
+
97
+ if($("this").hasClass('_active')){
98
+
99
+ $(this).removeClass('_active');
100
+
101
+ $(".line").removeClass('_open');
102
+
103
+
104
+
105
+ $(nav).removeClass("nav-open");
106
+
107
+ // $(".drawer-nav").removeClass('_active');
108
+
109
+
110
+
111
+ $('.overlay').removeClass('_open');
112
+
113
+ }else{
114
+
115
+ $(this).addClass('_active');
116
+
117
+ $('.line').addClass('_open');
118
+
119
+
120
+
121
+ $(nav).addClass("nav-open");
122
+
123
+ $('.drawer-nav').addClass('_open');
124
+
125
+ $('.overlay').addClass('_open');
126
+
127
+ }
128
+
129
+ });
130
+
131
+
132
+
133
+ $('.overlay').on('click',function(){
134
+
135
+ if($(this).hasClass('_open')){
136
+
137
+
138
+
139
+ $(this).removeClass('_open');
140
+
141
+ $('.humburger').removeClass('_active');
142
+
143
+ $('.line').removeClass('_open');
144
+
145
+
146
+
147
+ $(nav).removeClass('nav-open');
148
+
149
+ // $('.drawer-nav').removeClass('_active');
150
+
151
+ }
152
+
153
+ });
154
+
155
+ });
156
+
157
+
158
+
159
+ ```
184
160
 
185
161
 
186
162
 

3

修正しました

2021/11/05 11:42

投稿

free_teku
free_teku

スコア103

test CHANGED
File without changes
test CHANGED
@@ -7,6 +7,10 @@
7
7
  [drawer](http://demo.tivel.jp/n/drawer/)
8
8
 
9
9
  ![現状](13acebe7ba6700112136141cbab2e1e1.jpeg) 
10
+
11
+
12
+
13
+ ご教授お願い致します。
10
14
 
11
15
 
12
16
 
@@ -21,6 +25,20 @@
21
25
  transform
22
26
 
23
27
  jsのコードをURLから読み、どんな順序で設定しているのか理解はしていますが、、できずにいます。
28
+
29
+
30
+
31
+ ### 追記
32
+
33
+ 様々なことを試しました。
34
+
35
+ transform: translateZ(0); の書く場所が間違っているのか?→div toolでnavに書くと、反応する。しかし、humburgerクリック時、戻らない
36
+
37
+ 今は,
38
+
39
+ addClassでnavの開閉をしようとしていますが,append(<style> transformの変更)を試みようとしました→未解決
40
+
41
+
24
42
 
25
43
  ```
26
44
 
@@ -156,635 +174,17 @@
156
174
 
157
175
  </html>
158
176
 
159
- ```
160
177
 
161
- ```CSS
162
178
 
163
- .header {
164
-
165
- position: fixed;
166
-
167
- top: 0;
168
-
169
- z-index: 999;
170
-
171
- width: 100%;
172
-
173
- max-height: 80px;
174
-
175
- background-color: transparent;
176
-
177
- display: -webkit-box;
178
-
179
- display: -webkit-flex;
180
-
181
- display: -ms-flexbox;
182
-
183
- display: flex;
184
-
185
- -webkit-box-pack: justify;
186
-
187
- -webkit-justify-content: space-between;
179
+ 具体的なHTML,CSS,Jsは下記でございます。何卒宜しくお願い致します。
188
-
189
- -ms-flex-pack: justify;
190
-
191
- justify-content: space-between;
192
-
193
- padding: 10px 20px;
194
-
195
- }
196
180
 
197
181
 
198
182
 
199
- @media screen and (min-width: 600px) and (max-width: 1179px) {
183
+ [コード](https://jsfiddle.net/take0844/zk5sh2wn/5/)
200
-
201
- .header {
202
-
203
- position: fixed;
204
-
205
- top: 0;
206
-
207
- padding: 15px 20px;
208
-
209
- }
210
-
211
- }
212
184
 
213
185
 
214
186
 
215
- @media screen and (max-width: 599px) {
216
-
217
- .header {
218
-
219
- position: fixed;
220
-
221
- top: 0;
222
-
223
- padding: 8px 10px;
224
-
225
- max-height: 60px;
226
-
227
- }
228
-
229
- }
230
-
231
-
232
-
233
- .header-inner {
187
+ 今回はheader部分のnavです。
234
-
235
- max-width: 1880px;
236
-
237
- width: 100%;
238
-
239
- display: -webkit-box;
240
-
241
- display: -webkit-flex;
242
-
243
- display: -ms-flexbox;
244
-
245
- display: flex;
246
-
247
- -webkit-box-align: center;
248
-
249
- -webkit-align-items: center;
250
-
251
- -ms-flex-align: center;
252
-
253
- align-items: center;
254
-
255
- margin: 0 auto;
256
-
257
- box-sizing: border-box;
258
-
259
- -webkit-box-sizing: border-box;
260
-
261
- }
262
-
263
-
264
-
265
- .header-left {
266
-
267
- display: -webkit-box;
268
-
269
- display: -webkit-flex;
270
-
271
- display: -ms-flexbox;
272
-
273
- display: flex;
274
-
275
- -webkit-box-pack: left;
276
-
277
- -webkit-justify-content: left;
278
-
279
- -ms-flex-pack: left;
280
-
281
- justify-content: left;
282
-
283
- -webkit-box-align: center;
284
-
285
- -webkit-align-items: center;
286
-
287
- -ms-flex-align: center;
288
-
289
- align-items: center;
290
-
291
- }
292
-
293
-
294
-
295
- .header-left h1 {
296
-
297
- display: block;
298
-
299
- }
300
-
301
-
302
-
303
- .header-left h1 .logo img {
304
-
305
- display: block;
306
-
307
- width: 130px;
308
-
309
- height: 130px;
310
-
311
- margin: 20px 120px 20px 20px;
312
-
313
- }
314
-
315
-
316
-
317
- .header-left .nav {
318
-
319
- display: -webkit-box;
320
-
321
- display: -webkit-flex;
322
-
323
- display: -ms-flexbox;
324
-
325
- display: flex;
326
-
327
- -webkit-box-pack: justify;
328
-
329
- -webkit-justify-content: space-between;
330
-
331
- -ms-flex-pack: justify;
332
-
333
- justify-content: space-between;
334
-
335
- -webkit-box-align: center;
336
-
337
- -webkit-align-items: center;
338
-
339
- -ms-flex-align: center;
340
-
341
- align-items: center;
342
-
343
- margin-left: 120px;
344
-
345
- /* @include tb {
346
-
347
- display: none;
348
-
349
- } */
350
-
351
- /* @include sp{
352
-
353
- right: -75%;
354
-
355
- } */
356
-
357
- }
358
-
359
-
360
-
361
- @media screen and (min-width: 600px) and (max-width: 1179px) {
362
-
363
- .header-left .nav {
364
-
365
- top: 80px;
366
-
367
- position: fixed;
368
-
369
- top: 150px;
370
-
371
- right: 0;
372
-
373
- z-index: 10;
374
-
375
- overflow: hidden;
376
-
377
- width: 16.25rem;
378
-
379
- background-color: #000;
380
-
381
- width: 50%;
382
-
383
- height: 60vh;
384
-
385
- -webkit-transform: translate(550px);
386
-
387
- transform: translate(550px);
388
-
389
- -webkit-transition: .5s;
390
-
391
- transition: .5s;
392
-
393
- }
394
-
395
- }
396
-
397
-
398
-
399
- @media screen and (max-width: 599px) {
400
-
401
- .header-left .nav {
402
-
403
- top: 60px;
404
-
405
- position: fixed;
406
-
407
- z-index: 2;
408
-
409
- overflow: hidden;
410
-
411
- width: 16.25rem;
412
-
413
- background-color: rgba(0, 0, 0, 0.9);
414
-
415
- width: 75%;
416
-
417
- -webkit-transition: margin-left .5s;
418
-
419
- transition: margin-left .5s;
420
-
421
- }
422
-
423
- }
424
-
425
-
426
-
427
- .header-left .nav .header-list {
428
-
429
- display: -webkit-box;
430
-
431
- display: -webkit-flex;
432
-
433
- display: -ms-flexbox;
434
-
435
- display: flex;
436
-
437
- -webkit-box-align: center;
438
-
439
- -webkit-align-items: center;
440
-
441
- -ms-flex-align: center;
442
-
443
- align-items: center;
444
-
445
- padding-top: 20px;
446
-
447
- padding-bottom: 20px;
448
-
449
- }
450
-
451
-
452
-
453
- .header-left .nav .header-list .header-item {
454
-
455
- color: #fff;
456
-
457
- }
458
-
459
-
460
-
461
- @media screen and (max-width: 599px) {
462
-
463
- .header-left .nav .header-list .header-item {
464
-
465
- padding: 20px;
466
-
467
- font-size: 2rem;
468
-
469
- }
470
-
471
- }
472
-
473
-
474
-
475
- .header-left .nav .header-list .header-item + .header-item {
476
-
477
- padding-left: 30px;
478
-
479
- }
480
-
481
-
482
-
483
- .header-left .nav .header-list .header-item > a {
484
-
485
- color: #fff;
486
-
487
- display: inline-block;
488
-
489
- -webkit-transition: .3s;
490
-
491
- transition: .3s;
492
-
493
- /* 0.3秒で拡大までの時間 */
494
-
495
- }
496
-
497
-
498
-
499
- .header-left .drawer-nav_active {
500
-
501
- -webkit-transform: translateZ(0);
502
-
503
- transform: translateZ(0);
504
-
505
- }
506
-
507
-
508
-
509
- .header-right {
510
-
511
- margin-left: auto;
512
-
513
- }
514
-
515
-
516
-
517
- @media screen and (max-width: 599px) {
518
-
519
- .header-right {
520
-
521
- margin-left: 20px;
522
-
523
- }
524
-
525
- }
526
-
527
-
528
-
529
- .header-right .header-link {
530
-
531
- /* height: calc(54/80*100%);
532
-
533
- background-color: $link-color;
534
-
535
- border-radius: 3px;
536
-
537
- padding: 15px 35px;
538
-
539
- display: flex;
540
-
541
- justify-content: flex-end;
542
-
543
- align-items: center; */
544
-
545
- }
546
-
547
-
548
-
549
- @media screen and (min-width: 600px) and (max-width: 1179px) {
550
-
551
- .header-right .header-link {
552
-
553
- margin-left: auto;
554
-
555
- }
556
-
557
- }
558
-
559
-
560
-
561
- .header-right .header-link .calender-link {
562
-
563
- display: block;
564
-
565
- background-color: #978F10;
566
-
567
- text-decoration: none;
568
-
569
- font-weight: bold;
570
-
571
- -webkit-box-align: center;
572
-
573
- -webkit-align-items: center;
574
-
575
- -ms-flex-align: center;
576
-
577
- align-items: center;
578
-
579
- text-align: center;
580
-
581
- color: #fff;
582
-
583
- padding: 10px 37px;
584
-
585
- font-size: 1.6rem;
586
-
587
- -webkit-transition: .3s;
588
-
589
- transition: .3s;
590
-
591
- }
592
-
593
-
594
-
595
- @media screen and (min-width: 600px) and (max-width: 1179px) {
596
-
597
- .header-right .header-link .calender-link {
598
-
599
- margin-right: 100px;
600
-
601
- }
602
-
603
- }
604
-
605
-
606
-
607
- @media screen and (max-width: 599px) {
608
-
609
- .header-right .header-link .calender-link {
610
-
611
- padding: 8px 16px;
612
-
613
- font-size: 1.4rem;
614
-
615
- }
616
-
617
- }
618
-
619
-
620
-
621
- .header-right .header-link .calender-link::before {
622
-
623
- content: "";
624
-
625
- display: inline-block;
626
-
627
- margin: -3px 5px 0 0;
628
-
629
- background: url(../../img/calender.png) no-repeat;
630
-
631
- background-size: contain;
632
-
633
- vertical-align: middle;
634
-
635
- width: 22px;
636
-
637
- height: 22px;
638
-
639
- }
640
-
641
-
642
-
643
- .header-right .header-link .calender-link:hover {
644
-
645
- background-color: #000;
646
-
647
- }
648
-
649
-
650
-
651
- /* .nav-wrapper{
652
-
653
- height: 100%;
654
-
655
- overflow-x: hidden;
656
-
657
- position: relative;
658
-
659
- } */
660
-
661
- .overlay {
662
-
663
- content: "";
664
-
665
- display: block;
666
-
667
- width: 0;
668
-
669
- height: 0;
670
-
671
- background-color: rgba(0, 0, 0, 0.5);
672
-
673
- position: absolute;
674
-
675
- top: 0;
676
-
677
- left: 0;
678
-
679
- z-index: 2;
680
-
681
- opacity: 0;
682
-
683
- -webkit-transition: opacity .5s;
684
-
685
- transition: opacity .5s;
686
-
687
- }
688
-
689
-
690
-
691
- .overlay._open {
692
-
693
- width: 100%;
694
-
695
- height: 100%;
696
-
697
- opacity: 1;
698
-
699
- }
700
-
701
- ```
702
-
703
- ```js
704
-
705
- $(function(){
706
-
707
- $(".humburger").on('click', function(){
708
-
709
- //humberger
710
-
711
- /* $(this).toggleClass("_active");
712
-
713
- $(".line").toggleClass("_open"); */
714
-
715
-
716
-
717
- //nav
718
-
719
- //$("nav").addClass("nav-open");
720
-
721
- //$(".drawer-nav").toggleClass("_active");
722
-
723
-
724
-
725
- if($("this").hasClass('_active')){
726
-
727
- $(this).removeClass('_active');
728
-
729
- $(".line").removeClass('_open');
730
-
731
-
732
-
733
- $(".drawer-nav").removeClass('_active');
734
-
735
- //$("nav").removeClass("nav-open");
736
-
737
-
738
-
739
- $('.overlay').removeClass('_open');
740
-
741
- }else{
742
-
743
- $(this).addClass('_active');
744
-
745
- $('.line').addClass('_open');
746
-
747
-
748
-
749
- $('.drawer-nav').addClass('_active');
750
-
751
- //$("nav").addClass("nav-open");
752
-
753
- $('.overlay').addClass('_open');
754
-
755
- }
756
-
757
- });
758
-
759
-
760
-
761
- $('.overlay').on('click',function(){
762
-
763
- if($(this).hasClass('_open')){
764
-
765
- $(this).removeClass('_open');
766
-
767
- $('.humburger').removeClass('_active');
768
-
769
- $('.line').removeClass('_open');
770
-
771
-
772
-
773
- //$('nav').removeClass('nav-open');
774
-
775
- $('.drawer-nav').removeClass('_active');
776
-
777
-
778
-
779
- }
780
-
781
- });
782
-
783
- });
784
-
785
-
786
-
787
- ```
788
188
 
789
189
 
790
190
 

2

修正しました

2021/11/05 09:30

投稿

free_teku
free_teku

スコア103

test CHANGED
File without changes
test CHANGED
@@ -6,9 +6,7 @@
6
6
 
7
7
  [drawer](http://demo.tivel.jp/n/drawer/)
8
8
 
9
- ![現状](13acebe7ba6700112136141cbab2e1e1.jpeg)
9
+ ![現状](13acebe7ba6700112136141cbab2e1e1.jpeg) 
10
-
11
-
12
10
 
13
11
 
14
12
 
@@ -44,6 +42,18 @@
44
42
 
45
43
 
46
44
 
45
+ ### 追記(行ったこと)
46
+
47
+ ※$("nav").css('display': 'none');
48
+
49
+ $("head").append('<style> nav{display: none;} </style>');
50
+
51
+ jsに humburgerに'_active'がないとき、上記を書いてもうまくいきません。ご教授お願い致します。
52
+
53
+
54
+
55
+
56
+
47
57
  ### 該当のソースコード
48
58
 
49
59
 

1

修正いたしました

2021/11/05 08:07

投稿

free_teku
free_teku

スコア103

test CHANGED
File without changes
test CHANGED
@@ -38,6 +38,8 @@
38
38
 
39
39
  どなたか、ご教授いただけると幸いです。
40
40
 
41
+ ※仮説:nav(bg-colorを指定している)もjsで扱わないといけないのですか??
42
+
41
43
 
42
44
 
43
45