Get div's offsetTop positions in React

前端 未结 6 854
暗喜
暗喜 2021-01-30 08:08

I am trying to implement a List view in React. What I am trying to achieve is that to store the list headers informations and register the components and register the scroll ev

6条回答
  •  感情败类
    2021-01-30 09:06

    You may be encouraged to use the Element.getBoundingClientRect() method to get the top offset of your element. This method provides the full offset values (left, top, right, bottom, width, height) of your element in the viewport.

    Check the John Resig's post describing how helpful this method is.

提交回复
热议问题