[Vuejs]-Find div on scroll using VUE.js

0👍

I would suggest, like @Daniel said, to use a scroll event listener that checks the bounding box of the div and checks if it is in the middle of the page, then execute the function

One caveat, this is resource intensive so you’ll want a function like _.throttle from Lodash to keep it from firing constantly when scrolling.

document.body.addEventListener('scroll', _.throttle(checkBoundingBox, 100))

Leave a comment