The title should explain it, but here is some more detail.
I'm creating a CMS that will allow the client to input their own content. The component I'm creating will have sections that will highlight when window center scroll position is within the section height. At render I am getting let {top, bottom} = row.getBoundingClientRect()
of each section and storing those in an array. I'd like to then create a method that loops through the array and creates if statements that will later be checked in my handleScroll (event)
method.
I was thinking of just creating a forEach loop on the stored top,bottom
array and checking within the handleScroll
method, but I'm concerned about performance.
I'm wondering what the best way to do this would be?
Aucun commentaire:
Enregistrer un commentaire