回答編集履歴
2
コード追記
answer
CHANGED
@@ -61,4 +61,40 @@
|
|
61
61
|
z-index: -1;
|
62
62
|
}
|
63
63
|
}
|
64
|
-
```
|
64
|
+
```
|
65
|
+
|
66
|
+
スクロール禁止の別案
|
67
|
+
---
|
68
|
+
|
69
|
+
```html
|
70
|
+
<body>
|
71
|
+
<div class="bg">
|
72
|
+
</div>
|
73
|
+
<div class="wrapper">
|
74
|
+
.bg以外の要素をwrapperで囲む
|
75
|
+
</div>
|
76
|
+
</body>
|
77
|
+
```
|
78
|
+
|
79
|
+
bgのアニメーション終了まで .wrapper の高さを 0、
|
80
|
+
その後、auto にする。
|
81
|
+
|
82
|
+
```css
|
83
|
+
.wrapper {
|
84
|
+
z-index: 1;
|
85
|
+
position: relative;
|
86
|
+
animation: disableScroll .1s linear 2.8s both;
|
87
|
+
overflow: hidden;
|
88
|
+
}
|
89
|
+
|
90
|
+
@keyframes
|
91
|
+
disableScroll {
|
92
|
+
0%{
|
93
|
+
height: 0;
|
94
|
+
}
|
95
|
+
100%{
|
96
|
+
height: auto;
|
97
|
+
}
|
98
|
+
}
|
99
|
+
```
|
100
|
+
[Codepenサンプル](https://codepen.io/hatena19/pen/JjXJZVO?editors=0100)
|
1
追記
answer
CHANGED
@@ -15,4 +15,50 @@
|
|
15
15
|
overflow: auto;
|
16
16
|
}
|
17
17
|
}
|
18
|
+
```
|
19
|
+
|
20
|
+
|
21
|
+
---
|
22
|
+
アニメーション後もリンク等をクリックできない現象の対処法。
|
23
|
+
|
24
|
+
原因
|
25
|
+
```css
|
26
|
+
@keyframes
|
27
|
+
bgAnime {
|
28
|
+
0%{
|
29
|
+
opacity: 1;
|
30
|
+
}
|
31
|
+
99%{
|
32
|
+
opacity: 0;
|
33
|
+
}
|
34
|
+
100%{
|
35
|
+
opacity: 0;
|
36
|
+
display: none;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
```
|
40
|
+
上記の `display: none;` div.bg を消したつもりかもしれませんが、display は @keyframes の対象外のプロパティです。
|
41
|
+
@keyframes の対象になるプロパティは数値として設定できるものになります。
|
42
|
+
アニメーションは数値の増減で表現するものなので。
|
43
|
+
|
44
|
+
[アニメーション可能な CSS プロパティ - CSS: カスケーディングスタイルシート | MDN](https://developer.mozilla.org/ja/docs/Web/CSS/CSS_animated_properties)
|
45
|
+
|
46
|
+
z-index は数値設定ですので、これで背面に移動させればクリックできるようになります。
|
47
|
+
|
48
|
+
```css
|
49
|
+
@keyframes
|
50
|
+
bgAnime {
|
51
|
+
0%{
|
52
|
+
opacity: 1;
|
53
|
+
z-index: 2;
|
54
|
+
}
|
55
|
+
99%{
|
56
|
+
opacity: 0;
|
57
|
+
z-index: 2;
|
58
|
+
}
|
59
|
+
100%{
|
60
|
+
opacity: 0;
|
61
|
+
z-index: -1;
|
62
|
+
}
|
63
|
+
}
|
18
64
|
```
|