You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
actually isn't a correct way to calculate the distance to the top, since it uses offsetTop which basically works incrementally only when we're dealing with non-static elements or table layouts.
(also, even if it could work like that, the function reassigns ele to its parent before taking its own offset and doesn't take into account a border height)
Maybe the tip needs to be updated on the limitations of this algorithm or deleted altogether since now the function is presented as a universal way to calculate the distance to the page top.
The text was updated successfully, but these errors were encountered:
Hi and kudos for the great work!
I've noticed something odd on the page "parentElement vs parentNode".
Function distanceToTop in a Tip paragraph
actually isn't a correct way to calculate the distance to the top, since it uses offsetTop which basically works incrementally only when we're dealing with non-static elements or table layouts.
(also, even if it could work like that, the function reassigns ele to its parent before taking its own offset and doesn't take into account a border height)
A little example: https://codepen.io/Kindred-Spirit/pen/mdPRgJB
Maybe the tip needs to be updated on the limitations of this algorithm or deleted altogether since now the function is presented as a universal way to calculate the distance to the page top.
The text was updated successfully, but these errors were encountered: