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
Isn't the logic for this line exactly backwards? Perhaps some of the other related checks too.
l + VISIBLE_PADDING > p.offsetWidth + p.scrollLeft ... return false;
...as l represents the el.offsetLeft and p is it's parent? For example, l in my code is about 950 (px), and p's left is around 600px.
In this case, the function isVisible should instead return true, affirming the checked el is visible given that el's left edge is a greater value (further to the right) than is the parent p (smaller value, closer to the left edge.)
I could understand if the function was isHidden. Am I missing something?
The text was updated successfully, but these errors were encountered:
It appears that this line specifically (the rest seem fine) is comparing apples and oranges (left edge of child vs overall width of parent) especially in light of what the comment seems to indicate...
//-- If the target element is to the right of the parent elm
We would expect child's left edge (el.offsetLeft + VISIBLE_PADDING) to be to the right of its parent's left edge (p.offsetLeft) regardless of parent's size (p.offsetWidth + p.scrollLeft) in order for it to be visible (at least for this first test.)
In which case, shouldn't it be...
l + VISIBLE_PADDING < p.offsetLeft ... return false
...to check if child's left edge is further left (smaller value) than the parent's left edge, and therefor return false ("not visible")?
Isn't the logic for this line exactly backwards? Perhaps some of the other related checks too.
l + VISIBLE_PADDING > p.offsetWidth + p.scrollLeft
...return false;
...as
l
represents theel.offsetLeft
andp
is it's parent? For example,l
in my code is about 950 (px), and p's left is around 600px.In this case, the function isVisible should instead return true, affirming the checked el is visible given that el's left edge is a greater value (further to the right) than is the parent p (smaller value, closer to the left edge.)
I could understand if the function was
isHidden
. Am I missing something?The text was updated successfully, but these errors were encountered: