Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. function test() {
  2. const elm = document.querySelector('.panel');
  3. const options = {
  4. root: null,
  5. rootMargin: '0px',
  6. threshold: 0}
  7.  
  8. observer = new IntersectionObserver(elements => {
  9. elements.forEach(element => {
  10. if(element.intersectionRatio > 0) {
  11. var intersectionRatio = element.intersectionRatio;
  12. var isIntersecting = element.isIntersecting;
  13. var time = element.time;}
  14. });
  15. });
  16. observer.observe(elm );
  17. return time;}
  18.  
  19. VM32254:16 Uncaught TypeError: Failed to execute 'observe' on 'IntersectionObserver': parameter 1 is not of type 'Element'.
  20. at test (<anonymous>:16:14)
  21. at <anonymous>:1:1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement