Reputation: 129
How can I fetch the visible height of div when it scrolled (Visited your profile in October):
The full div height - 127px
. I've tried to dancing with getBoundingClientRect()
, but nothing has changed.
<div id="root">
...
<div id="statisticsContainer">
<p>
<Icon/>
Visited you profile in October
</p>
<div id="mainValueContainer">
<p>0</p>
</div>
</div>
</div>
Upvotes: 1
Views: 864
Reputation: 707
You can use the IntersectoinObserver
to detect the element coming into view, play around with the threshold
to get it detected when it's barely in view.
Element.offsetHeight
gives you the actual height
Upvotes: 1