質問編集履歴
2
参考サイト追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -559,3 +559,17 @@
|
|
559
559
|
|
560
560
|
|
561
561
|
scssで書いています。
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
### 追記
|
566
|
+
|
567
|
+
|
568
|
+
|
569
|
+
参考サイト
|
570
|
+
|
571
|
+
|
572
|
+
|
573
|
+
[モーダルウィンドウをプラグインなしで作る](https://webdesignday.jp/inspiration/technique/css/4680/)
|
574
|
+
|
575
|
+
[モーダルウィンドウのブラックアウト部分をクリックで閉じる](https://wheelchair-coder.com/145/)
|
1
header-sp-right全文に変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,7 +22,53 @@
|
|
22
22
|
|
23
23
|
```html
|
24
24
|
|
25
|
+
<div class="header-sp-right">
|
26
|
+
|
27
|
+
<nav class="header-sp-nav">
|
28
|
+
|
29
|
+
<ul class="header-sp-menu">
|
30
|
+
|
31
|
+
<li class="header-sp-room header-sp-menu-list"><a href="">お部屋</a></li>
|
32
|
+
|
33
|
+
<li class="header-sp-food header-sp-menu-list"><a href="">お料理</a></li>
|
34
|
+
|
35
|
+
<li class="header-sp-spa header-sp-menu-list"><a href="">温泉</a></li>
|
36
|
+
|
37
|
+
</ul>
|
38
|
+
|
39
|
+
<div class="header-sp-right-right">
|
40
|
+
|
41
|
+
<div class="header-sp-booking">
|
42
|
+
|
43
|
+
<a href="" class="js-modal-sp-open">
|
44
|
+
|
45
|
+
<div class="header-sp-booking-inner">
|
46
|
+
|
47
|
+
<img src="img/calender.png" alt="宿泊予約のカレンダー画像">
|
48
|
+
|
49
|
+
<p>宿泊予約</p>
|
50
|
+
|
51
|
+
</div>
|
52
|
+
|
53
|
+
</a>
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<div class="ham" id="ham">
|
58
|
+
|
59
|
+
<span class="ham-line ham-line1"></span>
|
60
|
+
|
61
|
+
<span class="ham-line ham-line2"></span>
|
62
|
+
|
63
|
+
<span class="ham-line ham-line3"></span>
|
64
|
+
|
65
|
+
</div>
|
66
|
+
|
67
|
+
</div>
|
68
|
+
|
69
|
+
</nav>
|
70
|
+
|
25
|
-
<div class="modal-sp js-modal-sp">
|
71
|
+
<div class="modal-sp js-modal-sp">
|
26
72
|
|
27
73
|
<div class="modal-sp-bg js-modal-sp-close">
|
28
74
|
|
@@ -78,7 +124,9 @@
|
|
78
124
|
|
79
125
|
</div>
|
80
126
|
|
81
|
-
</div>
|
127
|
+
</div><!-- /.modal-sp -->
|
128
|
+
|
129
|
+
</div><!-- /.header-sp-right -->
|
82
130
|
|
83
131
|
```
|
84
132
|
|
@@ -86,7 +134,267 @@
|
|
86
134
|
|
87
135
|
```scss
|
88
136
|
|
137
|
+
.header-sp-right {
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
display: none;
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
@include sspc {
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
display: flex;
|
150
|
+
|
151
|
+
}
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
.header-sp-nav {
|
156
|
+
|
157
|
+
margin-right: 2em;
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
.header-sp-menu {
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
display: none;
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
@include sspc {
|
170
|
+
|
171
|
+
width: 30%;
|
172
|
+
|
173
|
+
height: 100vh;
|
174
|
+
|
175
|
+
display: flex;
|
176
|
+
|
177
|
+
flex-direction: column;
|
178
|
+
|
179
|
+
background-color: rgba(0, 0, 0, 0.16);
|
180
|
+
|
181
|
+
transition: 0.3s;
|
182
|
+
|
183
|
+
position: fixed;
|
184
|
+
|
185
|
+
z-index: 20;
|
186
|
+
|
187
|
+
top: 7em;
|
188
|
+
|
189
|
+
right: -40%;
|
190
|
+
|
191
|
+
}
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
&:first-child {
|
196
|
+
|
197
|
+
padding-top: 20px;
|
198
|
+
|
199
|
+
}
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
.header-sp-menu-list {
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
a {
|
208
|
+
|
209
|
+
display: block;
|
210
|
+
|
211
|
+
font-size: 21px;
|
212
|
+
|
213
|
+
color: #FFFFFF;
|
214
|
+
|
215
|
+
padding: 1em;
|
216
|
+
|
217
|
+
}
|
218
|
+
|
219
|
+
}
|
220
|
+
|
221
|
+
}
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
.header-sp-right-right {
|
226
|
+
|
227
|
+
display: flex;
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
.header-sp-booking {
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
a {
|
236
|
+
|
237
|
+
display: block;
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
.header-sp-booking-inner {
|
242
|
+
|
243
|
+
width: 13em;
|
244
|
+
|
245
|
+
height: 4.4em;
|
246
|
+
|
247
|
+
background-color: #978F10;
|
248
|
+
|
249
|
+
display: flex;
|
250
|
+
|
251
|
+
align-items: center;
|
252
|
+
|
253
|
+
justify-content: center;
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
img {
|
258
|
+
|
259
|
+
width: 2em;
|
260
|
+
|
261
|
+
height: 2em;
|
262
|
+
|
263
|
+
padding-right: 1em;
|
264
|
+
|
265
|
+
}
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
p {
|
270
|
+
|
271
|
+
font-size: 1.6em;
|
272
|
+
|
273
|
+
font-weight: bold;
|
274
|
+
|
275
|
+
line-height: 3;
|
276
|
+
|
277
|
+
color: #FFFFFF;
|
278
|
+
|
279
|
+
}
|
280
|
+
|
281
|
+
}
|
282
|
+
|
283
|
+
}
|
284
|
+
|
285
|
+
}
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
.ham {
|
290
|
+
|
291
|
+
display: none;
|
292
|
+
|
293
|
+
width: 5em;
|
294
|
+
|
295
|
+
height: 5em;
|
296
|
+
|
297
|
+
cursor: pointer;
|
298
|
+
|
299
|
+
position: relative;
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
@include sspc {
|
304
|
+
|
305
|
+
display: block;
|
306
|
+
|
307
|
+
}
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
.ham-line {
|
312
|
+
|
313
|
+
position: absolute;
|
314
|
+
|
315
|
+
left: 1em;
|
316
|
+
|
317
|
+
width: 3em;
|
318
|
+
|
319
|
+
height: 0.2em;
|
320
|
+
|
321
|
+
background-color: #FFFFFF;
|
322
|
+
|
323
|
+
transition: all 0.3s;
|
324
|
+
|
325
|
+
}
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
.ham-line1 {
|
330
|
+
|
331
|
+
top: 0.7em;
|
332
|
+
|
333
|
+
}
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
.ham-line1.open {
|
338
|
+
|
339
|
+
transform: rotate(45deg);
|
340
|
+
|
341
|
+
top: 2em;
|
342
|
+
|
343
|
+
}
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
.ham-line2 {
|
348
|
+
|
349
|
+
top: 1.9em;
|
350
|
+
|
351
|
+
}
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
.ham-line2.open {
|
356
|
+
|
357
|
+
width: 0;
|
358
|
+
|
359
|
+
}
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
.ham-line3 {
|
364
|
+
|
365
|
+
top: 3.2em;
|
366
|
+
|
367
|
+
}
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
.ham-line3.open {
|
372
|
+
|
373
|
+
transform: rotate(-45deg);
|
374
|
+
|
375
|
+
top: 2em;
|
376
|
+
|
377
|
+
}
|
378
|
+
|
379
|
+
}
|
380
|
+
|
381
|
+
}
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
}
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
.header-sp-menu.open {
|
390
|
+
|
391
|
+
right: 0;
|
392
|
+
|
393
|
+
}
|
394
|
+
|
395
|
+
|
396
|
+
|
89
|
-
.modal-sp {
|
397
|
+
.modal-sp {
|
90
398
|
|
91
399
|
display: none;
|
92
400
|
|
@@ -148,29 +456,77 @@
|
|
148
456
|
|
149
457
|
}
|
150
458
|
|
459
|
+
}
|
460
|
+
|
151
461
|
```
|
152
462
|
|
153
463
|
|
154
464
|
|
155
465
|
```javascript
|
156
466
|
|
467
|
+
$(function () {
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
//ハンバーガーメニュー開閉
|
472
|
+
|
473
|
+
$('.ham').on('click', function () {
|
474
|
+
|
475
|
+
$('.header-sp-menu, .ham, .ham-line1, .ham-line2, .ham-line3').toggleClass('open');
|
476
|
+
|
477
|
+
});
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
//ハンバーガーメニューのナビリンククリック後自動で閉じる
|
482
|
+
|
483
|
+
$('.header-sp-menu-list a').on('click', function () {
|
484
|
+
|
485
|
+
$('.ham').click();
|
486
|
+
|
487
|
+
});
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
//スクロールしたらヘッダーが変わる
|
492
|
+
|
493
|
+
window.addEventListener('scroll', function () {
|
494
|
+
|
495
|
+
var header = document.querySelector('header');
|
496
|
+
|
497
|
+
header.classList.toggle('scroll-nav', window.scrollY > 0);
|
498
|
+
|
499
|
+
});
|
500
|
+
|
501
|
+
|
502
|
+
|
503
|
+
|
504
|
+
|
505
|
+
//宿泊予約モーダル(SP)
|
506
|
+
|
157
507
|
$('.js-modal-sp-open').on('click', function () {
|
158
508
|
|
159
509
|
$('.js-modal-sp').fadeIn();
|
160
510
|
|
511
|
+
|
512
|
+
|
513
|
+
//ハンバーガーメニューをクリックしていても、宿泊予約がクリックされるとメニューが閉じる
|
514
|
+
|
515
|
+
$('.header-sp-menu, .ham, .ham-line1, .ham-line2, .ham-line3').removeClass('open');
|
516
|
+
|
517
|
+
|
518
|
+
|
161
519
|
return false;
|
162
520
|
|
163
521
|
});
|
164
522
|
|
165
|
-
|
166
|
-
|
167
523
|
$('.js-modal-sp-close').on('click', function () {
|
168
524
|
|
169
525
|
$('.js-modal-sp').fadeOut();
|
170
526
|
|
171
527
|
|
172
528
|
|
173
|
-
//しかし、formをクリックでキャンセルさせる
|
529
|
+
//しかし、.formをクリックでキャンセルさせる
|
174
530
|
|
175
531
|
$('form').on('click', function (e) {
|
176
532
|
|
@@ -182,6 +538,10 @@
|
|
182
538
|
|
183
539
|
});
|
184
540
|
|
541
|
+
|
542
|
+
|
543
|
+
});
|
544
|
+
|
185
545
|
```
|
186
546
|
|
187
547
|
|