回答編集履歴
2
コード追記
test
CHANGED
@@ -125,3 +125,75 @@
|
|
125
125
|
}
|
126
126
|
|
127
127
|
```
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
スクロール禁止の別案
|
132
|
+
|
133
|
+
---
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
```html
|
138
|
+
|
139
|
+
<body>
|
140
|
+
|
141
|
+
<div class="bg">
|
142
|
+
|
143
|
+
</div>
|
144
|
+
|
145
|
+
<div class="wrapper">
|
146
|
+
|
147
|
+
.bg以外の要素をwrapperで囲む
|
148
|
+
|
149
|
+
</div>
|
150
|
+
|
151
|
+
</body>
|
152
|
+
|
153
|
+
```
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
bgのアニメーション終了まで .wrapper の高さを 0、
|
158
|
+
|
159
|
+
その後、auto にする。
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
```css
|
164
|
+
|
165
|
+
.wrapper {
|
166
|
+
|
167
|
+
z-index: 1;
|
168
|
+
|
169
|
+
position: relative;
|
170
|
+
|
171
|
+
animation: disableScroll .1s linear 2.8s both;
|
172
|
+
|
173
|
+
overflow: hidden;
|
174
|
+
|
175
|
+
}
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
@keyframes
|
180
|
+
|
181
|
+
disableScroll {
|
182
|
+
|
183
|
+
0%{
|
184
|
+
|
185
|
+
height: 0;
|
186
|
+
|
187
|
+
}
|
188
|
+
|
189
|
+
100%{
|
190
|
+
|
191
|
+
height: auto;
|
192
|
+
|
193
|
+
}
|
194
|
+
|
195
|
+
}
|
196
|
+
|
197
|
+
```
|
198
|
+
|
199
|
+
[Codepenサンプル](https://codepen.io/hatena19/pen/JjXJZVO?editors=0100)
|
1
追記
test
CHANGED
@@ -33,3 +33,95 @@
|
|
33
33
|
}
|
34
34
|
|
35
35
|
```
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
---
|
42
|
+
|
43
|
+
アニメーション後もリンク等をクリックできない現象の対処法。
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
原因
|
48
|
+
|
49
|
+
```css
|
50
|
+
|
51
|
+
@keyframes
|
52
|
+
|
53
|
+
bgAnime {
|
54
|
+
|
55
|
+
0%{
|
56
|
+
|
57
|
+
opacity: 1;
|
58
|
+
|
59
|
+
}
|
60
|
+
|
61
|
+
99%{
|
62
|
+
|
63
|
+
opacity: 0;
|
64
|
+
|
65
|
+
}
|
66
|
+
|
67
|
+
100%{
|
68
|
+
|
69
|
+
opacity: 0;
|
70
|
+
|
71
|
+
display: none;
|
72
|
+
|
73
|
+
}
|
74
|
+
|
75
|
+
}
|
76
|
+
|
77
|
+
```
|
78
|
+
|
79
|
+
上記の `display: none;` div.bg を消したつもりかもしれませんが、display は @keyframes の対象外のプロパティです。
|
80
|
+
|
81
|
+
@keyframes の対象になるプロパティは数値として設定できるものになります。
|
82
|
+
|
83
|
+
アニメーションは数値の増減で表現するものなので。
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
[アニメーション可能な CSS プロパティ - CSS: カスケーディングスタイルシート | MDN](https://developer.mozilla.org/ja/docs/Web/CSS/CSS_animated_properties)
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
z-index は数値設定ですので、これで背面に移動させればクリックできるようになります。
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
```css
|
96
|
+
|
97
|
+
@keyframes
|
98
|
+
|
99
|
+
bgAnime {
|
100
|
+
|
101
|
+
0%{
|
102
|
+
|
103
|
+
opacity: 1;
|
104
|
+
|
105
|
+
z-index: 2;
|
106
|
+
|
107
|
+
}
|
108
|
+
|
109
|
+
99%{
|
110
|
+
|
111
|
+
opacity: 0;
|
112
|
+
|
113
|
+
z-index: 2;
|
114
|
+
|
115
|
+
}
|
116
|
+
|
117
|
+
100%{
|
118
|
+
|
119
|
+
opacity: 0;
|
120
|
+
|
121
|
+
z-index: -1;
|
122
|
+
|
123
|
+
}
|
124
|
+
|
125
|
+
}
|
126
|
+
|
127
|
+
```
|