davidnguyen11 / react-is-in-viewport

πŸš€πŸ“±The component allows to detect whether or not the component is in the viewport πŸš€πŸ“±
MIT License
15 stars 2 forks source link

Apply Intersection Observer API #19

Open davidnguyen11 opened 4 years ago

davidnguyen11 commented 4 years ago

Problem Because of using get getBoundingClientRect, when we resize the browser window, the computation of coordinates (x, y), width and height will be different depends on the size of window

Solution

Consider using https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API