質問編集履歴
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -145,3 +145,203 @@
|
|
145
145
|
})();
|
146
146
|
|
147
147
|
```
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
追記
|
152
|
+
|
153
|
+
```HTML
|
154
|
+
|
155
|
+
<!DOCTYPE html>
|
156
|
+
|
157
|
+
<html>
|
158
|
+
|
159
|
+
<head>
|
160
|
+
|
161
|
+
<meta http-equiv="content-type" charset="utf-8">
|
162
|
+
|
163
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
164
|
+
|
165
|
+
<title></title>
|
166
|
+
|
167
|
+
<meta name="description" content="">
|
168
|
+
|
169
|
+
<meta name="keywords" content="">
|
170
|
+
|
171
|
+
<link rel="stylesheet" href="public/css/index.css">
|
172
|
+
|
173
|
+
<link rel="stylesheet" href="public/css/all_common.css">
|
174
|
+
|
175
|
+
</head>
|
176
|
+
|
177
|
+
<body>
|
178
|
+
|
179
|
+
<section>
|
180
|
+
|
181
|
+
<h3 class="js-scroll"><span class="motion-txt"><span class="motion-inner">SCROLL</span></span></h3>
|
182
|
+
|
183
|
+
</section>
|
184
|
+
|
185
|
+
<section>
|
186
|
+
|
187
|
+
<h3 class="js-scroll"><span class="motion-txt"><span class="motion-inner">SCROLL</span></span></h3>
|
188
|
+
|
189
|
+
</section>
|
190
|
+
|
191
|
+
<section>
|
192
|
+
|
193
|
+
<h3 class="js-scroll"><span class="motion-txt"><span class="motion-inner">SCROLL</span></span></h3>
|
194
|
+
|
195
|
+
</section>
|
196
|
+
|
197
|
+
<script src="/public/js/javascript.js"></script>
|
198
|
+
|
199
|
+
</body>
|
200
|
+
|
201
|
+
</html>
|
202
|
+
|
203
|
+
```
|
204
|
+
|
205
|
+
```CSS
|
206
|
+
|
207
|
+
section{
|
208
|
+
|
209
|
+
text-align:center;
|
210
|
+
|
211
|
+
display: flex;
|
212
|
+
|
213
|
+
justify-content: center;
|
214
|
+
|
215
|
+
align-items: center;
|
216
|
+
|
217
|
+
height:100vh;
|
218
|
+
|
219
|
+
}
|
220
|
+
|
221
|
+
h3{
|
222
|
+
|
223
|
+
font-size:40px;
|
224
|
+
|
225
|
+
padding:10px;
|
226
|
+
|
227
|
+
}
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
.motion-txt {
|
232
|
+
|
233
|
+
display: inline-block;
|
234
|
+
|
235
|
+
position: relative;
|
236
|
+
|
237
|
+
overflow: hidden;
|
238
|
+
|
239
|
+
padding:10px;
|
240
|
+
|
241
|
+
}
|
242
|
+
|
243
|
+
.motion-txt:after {
|
244
|
+
|
245
|
+
content: '';
|
246
|
+
|
247
|
+
position: absolute;
|
248
|
+
|
249
|
+
opacity: 1;
|
250
|
+
|
251
|
+
left: 0;
|
252
|
+
|
253
|
+
top: 0;
|
254
|
+
|
255
|
+
bottom: 0;
|
256
|
+
|
257
|
+
width: 100%;
|
258
|
+
|
259
|
+
background-color: #000;
|
260
|
+
|
261
|
+
transform: translate3d(-101%, 0, 0);
|
262
|
+
|
263
|
+
}
|
264
|
+
|
265
|
+
.js-scroll.show .motion-txt:after {
|
266
|
+
|
267
|
+
transition-property: transform, opacity;
|
268
|
+
|
269
|
+
transition-duration: 0.5s;
|
270
|
+
|
271
|
+
transition-delay: 0s;
|
272
|
+
|
273
|
+
transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1);
|
274
|
+
|
275
|
+
transform: translate3d(0, 0, 0);
|
276
|
+
|
277
|
+
}
|
278
|
+
|
279
|
+
.js-scroll.done .motion-txt:after {
|
280
|
+
|
281
|
+
transition-property: transform;
|
282
|
+
|
283
|
+
transition-duration: 0.5s;
|
284
|
+
|
285
|
+
transition-delay: 0s;
|
286
|
+
|
287
|
+
transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1);
|
288
|
+
|
289
|
+
transform: translate3d(103%, 0, 0);
|
290
|
+
|
291
|
+
}
|
292
|
+
|
293
|
+
.motion-txt .motion-inner {
|
294
|
+
|
295
|
+
display: inline-block;
|
296
|
+
|
297
|
+
opacity: 0;
|
298
|
+
|
299
|
+
}
|
300
|
+
|
301
|
+
.js-scroll.done .motion-txt .motion-inner {
|
302
|
+
|
303
|
+
opacity: 1;
|
304
|
+
|
305
|
+
}
|
306
|
+
|
307
|
+
```
|
308
|
+
|
309
|
+
```js
|
310
|
+
|
311
|
+
var EffectH = 100;
|
312
|
+
|
313
|
+
$(window).on('scroll load', function() {
|
314
|
+
|
315
|
+
var scTop = $(this).scrollTop();
|
316
|
+
|
317
|
+
var scBottom = scTop + $(this).height();
|
318
|
+
|
319
|
+
var effectPos = scBottom - EffectH;
|
320
|
+
|
321
|
+
$('.js-scroll').each( function() {
|
322
|
+
|
323
|
+
var thisPos = $(this).offset().top;
|
324
|
+
|
325
|
+
if ( thisPos < effectPos ) {
|
326
|
+
|
327
|
+
$.when(
|
328
|
+
|
329
|
+
$(this).addClass("show")
|
330
|
+
|
331
|
+
).done(function() {
|
332
|
+
|
333
|
+
$(this).delay(500).queue(function(){
|
334
|
+
|
335
|
+
$(this).addClass("done")
|
336
|
+
|
337
|
+
})
|
338
|
+
|
339
|
+
});
|
340
|
+
|
341
|
+
}
|
342
|
+
|
343
|
+
});
|
344
|
+
|
345
|
+
});
|
346
|
+
|
347
|
+
```
|