@@ -278,15 +278,17 @@ let waitForFonts = document.fonts && document.fonts.ready ? document.fonts.ready
278
278
}
279
279
} ;
280
280
281
- const guideHeaders = document . querySelectorAll ( '.guide-content h2' ) ;
282
- const guideHeadersObserver = new IntersectionObserver ( ( entries ) => {
283
- return entries . forEach ( ( e ) => {
284
- animateHeader ( e . target , e . intersectionRatio ) ;
285
- } ) ;
286
- } , { threshold : 0.3 } ) ;
287
- for ( const guideHeader of guideHeaders ) {
288
- guideHeadersObserver . observe ( guideHeader ) ;
289
- guideHeadersObserver . observe ( guideHeader . closest ( 'section' ) ) ;
281
+ if ( 'IntersectionObserver' in window && 'IntersectionObserverEntry' in window && 'intersectionRatio' in window . IntersectionObserverEntry . prototype ) {
282
+ const guideHeaders = document . querySelectorAll ( '.guide-content h2' ) ;
283
+ const guideHeadersObserver = new IntersectionObserver ( ( entries ) => {
284
+ return entries . forEach ( ( e ) => {
285
+ animateHeader ( e . target , e . intersectionRatio ) ;
286
+ } ) ;
287
+ } , { threshold : 0.3 } ) ;
288
+ for ( const guideHeader of guideHeaders ) {
289
+ guideHeadersObserver . observe ( guideHeader ) ;
290
+ guideHeadersObserver . observe ( guideHeader . closest ( 'section' ) ) ;
291
+ }
290
292
}
291
293
292
294
// DETECT GRADIENT TRANSITION SUPPORT
@@ -329,14 +331,16 @@ let waitForFonts = document.fonts && document.fonts.ready ? document.fonts.ready
329
331
} ) ;
330
332
331
333
// also start once scrolling has revealed 10% of the poem
332
- const poemZoneObserver = new IntersectionObserver ( ( entries ) => {
333
- return entries . forEach ( ( e ) => {
334
- if ( e . intersectionRatio >= 0.1 ) {
335
- startIceDriftAnimation ( ) ;
336
- }
337
- } ) ;
338
- } , { threshold : 0.1 } ) ;
339
- poemZoneObserver . observe ( document . querySelector ( '#poem' ) ) ;
334
+ if ( 'IntersectionObserver' in window && 'IntersectionObserverEntry' in window && 'intersectionRatio' in window . IntersectionObserverEntry . prototype ) {
335
+ const poemZoneObserver = new IntersectionObserver ( ( entries ) => {
336
+ return entries . forEach ( ( e ) => {
337
+ if ( e . intersectionRatio >= 0.1 ) {
338
+ startIceDriftAnimation ( ) ;
339
+ }
340
+ } ) ;
341
+ } , { threshold : 0.1 } ) ;
342
+ poemZoneObserver . observe ( document . querySelector ( '#poem' ) ) ;
343
+ }
340
344
} ( ) ) ;
341
345
342
346
/*
0 commit comments