Last active
March 17, 2021 16:27
-
-
Save arijitMondal/215cc04436856f63a8375161ce5089dc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( | |
typeof window !== 'undefined' && | |
'IntersectionObserver' in window && | |
'IntersectionObserverEntry' in window && | |
'intersectionRatio' in window.IntersectionObserverEntry.prototype | |
) { | |
let observer = new IntersectionObserver() | |
//rest of the code | |
} else { | |
import('intersection-observer').then(() => { | |
let observer = new IntersectionObserver() | |
//rest of code | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I put this code in each page or I use only in _app,js?