質問編集履歴

1

コード内容を変更しました

2021/08/24 09:39

投稿

cutegirl
cutegirl

スコア9

test CHANGED
File without changes
test CHANGED
@@ -8,9 +8,7 @@
8
8
 
9
9
  ```HTML
10
10
 
11
- <header class="header01">
12
-
13
- <a class="menuButton" id="menuButton">
11
+ <a class="menuButton" id="menuButton">
14
12
 
15
13
  <div></div>
16
14
 
@@ -18,9 +16,11 @@
18
16
 
19
17
  <div></div>
20
18
 
21
- </a>
19
+ </a>
22
20
 
23
- </header>
21
+ ```
22
+
23
+
24
24
 
25
25
 
26
26
 
@@ -30,75 +30,151 @@
30
30
 
31
31
  .menuButton{
32
32
 
33
- display: block;
33
+ display: block;
34
34
 
35
- height: 80px;
35
+ height: 60px;
36
-
37
- width: 80px;
38
-
39
- background: pink;
40
-
41
- position: fixed;
42
-
43
- top: 0;
44
-
45
- right: 0;
46
-
47
- div{
48
-
49
- height: 1px;
50
36
 
51
37
  width: 60px;
52
38
 
53
39
  background: #000;
54
40
 
55
- position: absolute;
41
+ position: fixed;
56
42
 
57
- top: 50%;
43
+ top: 0;
58
44
 
59
- left: 50%;
45
+ right: 0;
60
46
 
61
- transform: translate(-50%, -50%);
47
+ z-index: 10;
62
48
 
63
- transition: 0.3s;
49
+ div{
64
50
 
65
- &:nth-of-type(1){
51
+ height: 3px;
66
52
 
67
- transform: translate(-50%, -15px);
53
+ width: 30px;
68
54
 
69
- }
55
+ background: #fff;
70
56
 
71
- &:nth-of-type(3){
57
+ position: absolute;
72
58
 
59
+ top: 50%;
60
+
61
+ left: 50%;
62
+
63
+ transform: translate(-50%, -50%);
64
+
65
+ transition: 0.3s;
66
+
67
+ border-radius: 10px;
68
+
69
+ &:nth-of-type(1){
70
+
71
+ transform: translate(-50%, -12px);
72
+
73
+ }
74
+
75
+ &:nth-of-type(3){
76
+
73
- transform: translate(-50%, 15px);
77
+ transform: translate(-50%, 10px);
78
+
79
+ }
74
80
 
75
81
  }
76
82
 
77
83
  }
78
84
 
79
- }
85
+ .menuButton.active div:nth-of-type(1){
80
86
 
81
- .menuButton.active div:nth-of-type(1){
87
+ transform: rotate(45deg) translate(-50%, 0);
82
88
 
83
- transform: rotate(45deg) translate(-50%, 0);
89
+ transform-origin: 0% 50%;
84
90
 
85
- transform-origin: 0% 50%;
91
+ }
86
92
 
87
- }
93
+ .menuButton.active div:nth-of-type(2){
88
94
 
89
- .menuButton.active div:nth-of-type(2){
95
+ opacity: 0;
90
96
 
91
- opacity: 0;
97
+ }
92
98
 
93
- }
99
+ .menuButton.active div:nth-of-type(3){
94
100
 
95
- .menuButton.active div:nth-of-type(3){
101
+ transform: rotate(-45deg) translate(-50%, 0);
96
102
 
97
- transform: rotate(-45deg) translate(-50%, 0);
103
+ transform-origin: 0% 50%;
98
104
 
99
- transform-origin: 0% 50%;
105
+ }
100
106
 
107
+ nav{
108
+
109
+ opacity: 0;
110
+
111
+ visibility: hidden;
112
+
113
+ transform:translate(20px, -20px);
114
+
115
+ transition: 0.3s;
116
+
117
+ position: fixed;
118
+
119
+ top: 0;
120
+
121
+ right: 0;
122
+
123
+ background: #efefef;
124
+
125
+ width: 100%;
126
+
127
+ height: 100%;
128
+
129
+ overflow: auto;
130
+
131
+ margin-top: 60px;
132
+
133
+ .list{
134
+
135
+ flex-direction: column;
136
+
137
+ li{
138
+
139
+ height: 60px;
140
+
141
+ line-height: 60px;
142
+
143
+ border-top: 1px solid #d8d8d8;
144
+
145
+ &:active{
146
+
147
+ background: #B8E5EA;
148
+
101
- }
149
+ }
150
+
151
+ &:last-child{
152
+
153
+ border-bottom: 1px solid #d8d8d8;
154
+
155
+ }
156
+
157
+ a{
158
+
159
+ display: block;
160
+
161
+ color: #000;
162
+
163
+ padding-left: 30px;
164
+
165
+ &:hover{
166
+
167
+ border-bottom: none;
168
+
169
+ }
170
+
171
+ }
172
+
173
+ }
174
+
175
+ }
176
+
177
+ }
102
178
 
103
179
  ```
104
180
 
@@ -110,7 +186,7 @@
110
186
 
111
187
  $("#menuButton").click(function(){
112
188
 
113
- $(this).addClass("active");
189
+ this.classList.toggle("active");
114
190
 
115
191
  });
116
192