質問するログイン新規登録

質問編集履歴

2

閉じタグ追加

2018/08/29 03:01

投稿

nagonago85
nagonago85

スコア10

title CHANGED
File without changes
body CHANGED
@@ -23,7 +23,7 @@
23
23
  <li class="luxbar-item"><a href="#menu2">MENU2</a></li>
24
24
  <li class="luxbar-item"><a href="#menu3">MENU3</a></li>
25
25
  <li class="luxbar-item"><a href="#menu4">MENU4</a></li>
26
- <li class="luxbar-item"><a href="#menu5">MENU5</a>
26
+ <li class="luxbar-item"><a href="#menu5">MENU5</a></li>
27
27
  </ul>
28
28
  </div>
29
29
  </header>

1

HTML、CSSを追加しました。

2018/08/29 03:01

投稿

nagonago85
nagonago85

スコア10

title CHANGED
File without changes
body CHANGED
@@ -5,4 +5,249 @@
5
5
  ページ内リンクだとメニュー画面が閉じません。
6
6
 
7
7
  jQueryなどを使えば、閉じることは可能でしょうか?
8
- また、その際はどのような記述をすれば良いかご教示いただきたいです。
8
+ また、その際はどのような記述をすれば良いかご教示いただきたいです。
9
+
10
+ ・HTMLメニュー部分
11
+ ```ここに言語を入力
12
+
13
+ <header id="luxbar" class="luxbar-fixed">
14
+ <input type="checkbox" class="luxbar-checkbox" id="luxbar-checkbox"/>
15
+ <div class="luxbar-menu luxbar-menu-right luxbar-menu-dark">
16
+ <ul class="luxbar-navigation">
17
+ <li class="luxbar-header">
18
+ <a href="#" class="luxbar-brand"><img src="img/sanrio_logo.png" class="sanrioLogo"></a>
19
+ <label class="luxbar-hamburger luxbar-hamburger-doublespin"
20
+ id="luxbar-hamburger" for="luxbar-checkbox"> <span></span> </label>
21
+ </li>
22
+ <li class="luxbar-item"><a href="#menu1">MENU1</a></li>
23
+ <li class="luxbar-item"><a href="#menu2">MENU2</a></li>
24
+ <li class="luxbar-item"><a href="#menu3">MENU3</a></li>
25
+ <li class="luxbar-item"><a href="#menu4">MENU4</a></li>
26
+ <li class="luxbar-item"><a href="#menu5">MENU5</a>
27
+ </ul>
28
+ </div>
29
+ </header>
30
+
31
+
32
+ <div id="menu1">
33
+ コンテンツが入ります。
34
+ </div>
35
+ <div id="menu2">
36
+ コンテンツが入ります。
37
+ </div>
38
+ <div id="menu3">
39
+ コンテンツが入ります。
40
+ </div>
41
+ <div id="menu4">
42
+ コンテンツが入ります。
43
+ </div>
44
+ <div id="menu5">
45
+ コンテンツが入ります。
46
+ </div>
47
+ ```
48
+
49
+ ・メニュー部分CSS
50
+ ```ここに言語を入力
51
+ .luxbar-default {
52
+ width: 100%;
53
+ position: relative;
54
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); }
55
+
56
+ .luxbar-static {
57
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
58
+ width: 100%;
59
+ position: absolute;
60
+ top: 0;
61
+ left: 0; }
62
+ .luxbar-static .luxbar-checkbox:checked ~ .luxbar-menu {
63
+ position: absolute; }
64
+
65
+ .luxbar-fixed {
66
+ width: 100%;
67
+ position: fixed;
68
+ top: 0;
69
+ left: 0;
70
+ z-index: 1000;
71
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); }
72
+
73
+ .luxbar-fixed-bottom {
74
+ width: 100%;
75
+ position: fixed;
76
+ bottom: 0;
77
+ left: 0;
78
+ z-index: 1000;
79
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); }
80
+
81
+ .luxbar-hamburger span, .luxbar-hamburger span::before, .luxbar-hamburger span::after {
82
+ display: block;
83
+ height: 2px;
84
+ width: 26px;
85
+ transition: 0.6s ease; }
86
+
87
+ .luxbar-checkbox:checked ~ .luxbar-menu li .luxbar-hamburger span {
88
+ background-color: transparent; }
89
+ .luxbar-checkbox:checked ~ .luxbar-menu li .luxbar-hamburger span::before, .luxbar-checkbox:checked ~ .luxbar-menu li .luxbar-hamburger span::after {
90
+ margin-top: 0; }
91
+
92
+ .luxbar-header {
93
+ display: flex;
94
+ flex-direction: row;
95
+ justify-content: space-between;
96
+ align-items: center;
97
+ height: 65px;
98
+ text-align: left;
99
+ padding-left: 10px;
100
+ }
101
+
102
+ .luxbar-menu-left .luxbar-navigation, .luxbar-menu-left .luxbar-header {
103
+ justify-content: flex-start; }
104
+
105
+ .luxbar-menu-right .luxbar-hamburger {
106
+ margin-left: auto; }
107
+
108
+ .luxbar-brand {
109
+ padding-right: 10px;
110
+ }
111
+
112
+ .luxbar-menu {
113
+ min-height: 58px;
114
+ transition: 0.6s ease;
115
+ width: 100%; }
116
+
117
+ .luxbar-navigation {
118
+ display: flex;
119
+ flex-direction: column;
120
+ list-style: none;
121
+ padding-left: 0;
122
+ margin: 0;
123
+ text-align: right;}
124
+
125
+ .luxbar-menu a,
126
+ .luxbar-item a {
127
+ text-decoration: none;
128
+ color: inherit;
129
+ cursor: pointer; }
130
+
131
+ .luxbar-item {
132
+ height: 58px; }
133
+ .luxbar-item a {
134
+ padding: 18px 9px 18px 9px;
135
+ display: block;
136
+ line-height: 98%;
137
+ }
138
+
139
+ .luxbar-hamburger {
140
+ padding: 18px 24px 18px 24px;
141
+ position: relative;
142
+ cursor: pointer; }
143
+ .luxbar-hamburger span::before, .luxbar-hamburger span::after {
144
+ content: '';
145
+ position: absolute; }
146
+ .luxbar-hamburger span::before {
147
+ margin-top: -8px; }
148
+ .luxbar-hamburger span::after {
149
+ margin-top: 8px; }
150
+
151
+ .luxbar-checkbox {
152
+ display: none; }
153
+ .luxbar-checkbox:not(:checked) ~ .luxbar-menu {
154
+ overflow: hidden;
155
+ height: 58px; }
156
+ .luxbar-checkbox:checked ~ .luxbar-menu {
157
+ transition: height 0.6s ease;
158
+ height: 100vh;
159
+ overflow: auto;
160
+ }
161
+
162
+ .dropdown {
163
+ position: relative;
164
+ height: auto;
165
+ min-height: 58px; }
166
+ .dropdown:hover > ul {
167
+ position: relative;
168
+ display: block;
169
+ min-width: 100%; }
170
+ .dropdown > a::after {
171
+ position: absolute;
172
+ content: '';
173
+ right: 10px;
174
+ top: 25px;
175
+ border-width: 5px 5px 0;
176
+ border-color: transparent;
177
+ border-style: solid; }
178
+ .dropdown > ul {
179
+ display: block;
180
+ overflow-x: hidden;
181
+ list-style: none;
182
+ padding: 0; }
183
+ .dropdown > ul .luxbar-item {
184
+ min-width: 100%;
185
+ height: 29px;
186
+ padding: 5px 10px 5px 40px; }
187
+ .dropdown > ul .luxbar-item a {
188
+ min-height: 29px;
189
+ line-height: 29px;
190
+ padding: 0; }
191
+
192
+ @media screen and (min-width: 767px) {
193
+ .luxbar-navigation {
194
+ flex-flow: row;
195
+ justify-content: flex-end;
196
+ text-align: left; }
197
+
198
+ .luxbar-hamburger {
199
+ display: none; }
200
+
201
+ .luxbar-checkbox:not(:checked) ~ .luxbar-menu {
202
+ overflow: visible; }
203
+ .luxbar-checkbox:checked ~ .luxbar-menu {
204
+ height: 58px; }
205
+
206
+ .luxbar-menu .luxbar-item {
207
+ border-top: 0; }
208
+
209
+ .luxbar-menu-right .luxbar-header {
210
+ margin-right: auto; }
211
+
212
+ .dropdown {
213
+ height: 58px; }
214
+ .dropdown:hover > ul {
215
+ position: absolute;
216
+ left: 0;
217
+ top: 58px;
218
+ padding: 0; }
219
+ .dropdown > ul {
220
+ display: none; }
221
+ .dropdown > ul .luxbar-item {
222
+ padding: 5px 10px; }
223
+ .dropdown > ul .luxbar-item a {
224
+ white-space: nowrap; } }
225
+ .luxbar-checkbox:checked + .luxbar-menu .luxbar-hamburger-doublespin span::before {
226
+ transform: rotate(225deg); }
227
+ .luxbar-checkbox:checked + .luxbar-menu .luxbar-hamburger-doublespin span::after {
228
+ transform: rotate(-225deg); }
229
+
230
+ .luxbar-checkbox:checked + .luxbar-menu .luxbar-hamburger-spin span::before {
231
+ transform: rotate(45deg); }
232
+ .luxbar-checkbox:checked + .luxbar-menu .luxbar-hamburger-spin span::after {
233
+ transform: rotate(-45deg); }
234
+
235
+ /******* color variables *******/
236
+ /******* default dark *******/
237
+ .luxbar-menu-dark,
238
+ .luxbar-menu-dark .dropdown ul {
239
+ background-color: rgba(0,0,0,0.5);
240
+ color: #fff;
241
+ }
242
+
243
+ .luxbar-menu-dark .active,
244
+ .luxbar-menu-dark .luxbar-item:hover {
245
+ color: #a2b4b7;}
246
+ .luxbar-menu-dark .luxbar-hamburger span,
247
+ .luxbar-menu-dark .luxbar-hamburger span::before,
248
+ .luxbar-menu-dark .luxbar-hamburger span::after {
249
+ background-color: #fff; }
250
+
251
+ ```
252
+
253
+ CSSのみで作成されたレスポンシブ対応のナビゲーションでしたので、jsなどはありませんでした。