88
88
</ div >
89
89
</ section >
90
90
91
- < section class ="animate__animated ">
91
+ < section class ="animation animate__animated ">
92
92
< div class ="container is-fluid ">
93
93
< div class ="columns is-multiline ">
94
94
156
156
</ div >
157
157
</ section >
158
158
159
- < section class ="animate__animated ">
159
+ < section class ="animation animate__animated animate__delay-1s ">
160
160
< div class ="container is-fluid ">
161
161
< div class ="columns is-multiline ">
162
162
191
191
</ div >
192
192
</ section >
193
193
194
- < section class ="animate__animated ">
194
+ < section class ="animation animate__animated animate__delay-1s ">
195
195
< div class ="container is-fluid ">
196
196
< div class ="columns is-multiline ">
197
197
225
225
</ div >
226
226
</ section >
227
227
228
- < section class ="animate__animated ">
228
+ < section class ="animation animate__animated animate__delay-1s ">
229
229
< div class ="container is-fluid ">
230
230
< div class ="columns is-multiline ">
231
231
265
265
</ div >
266
266
</ section >
267
267
268
- < section class ="animate__animated ">
268
+ < section class ="animation animate__animated animate__delay-1s ">
269
269
< div class ="container is-fluid ">
270
270
< div class ="columns is-multiline ">
271
271
304
304
305
305
< footer >
306
306
< div class ="container is-fluid ">
307
- < div class ="columns is-gapless ">
307
+ < div class ="columns is-multiline ">
308
308
< div class ="column is-full ">
309
309
< a href ="https://dribbble.com/marulango " target ="_blank ">
310
310
< svg >
330
330
</ div >
331
331
</ div >
332
332
</ div >
333
- < script >
334
- $ ( window ) . on ( 'scroll' , function ( ) {
335
- if ( $ ( "section.animate__animated" ) . is ( ':visible' ) ) {
336
- $ ( "section.animate__animated" ) . addClass ( "animate__fadeIn" ) ;
337
- }
333
+ </ footer >
334
+ < script >
335
+ function addAnimationClass ( entries , observer ) {
336
+ entries . forEach ( entry => {
337
+
338
+ if ( entry . isIntersecting ) {
339
+ entry . target . classList . add ( 'animate__fadeIn' ) ;
340
+ } else {
341
+ entry . target . classList . remove ( 'animate__fadeIn' ) ;
342
+ }
343
+ } ) ;
344
+ }
345
+
346
+
347
+ let observer = new IntersectionObserver ( addAnimationClass , {
348
+ root : null ,
349
+ rootMargin : '0px' ,
350
+ threshold : 0.1
351
+ } ) ;
352
+
353
+
354
+ document . querySelectorAll ( '.animation' ) . forEach ( testElem => {
355
+ observer . observe ( testElem ) ; // Observe each 'test' element
338
356
} ) ;
339
357
</ script >
340
- </ footer >
341
358
</ body >
342
359
</ html >
0 commit comments