Update utils.js
This commit is contained in:
parent
902fa3a171
commit
e9098123b4
1 changed files with 7 additions and 5 deletions
|
|
@ -384,11 +384,13 @@ class Util {
|
|||
}
|
||||
|
||||
isChildVisible(parentNode, childNode) {
|
||||
let top = parentNode.scrollTop;
|
||||
let bottom = top + parentNode.clientHeight;
|
||||
const childTop = childNode.offsetTop;
|
||||
const childBottom = childTop + childNode.clientHeight;
|
||||
return ((childTop >= top && childTop < bottom) || (childBottom > top && childBottom <= bottom));
|
||||
const rect1 = parentNode.getBoundingClientRect();
|
||||
const rect2 = childNode.getBoundingClientRect();
|
||||
var overlap = !(rect1.right < rect2.left ||
|
||||
rect1.left > rect2.right ||
|
||||
rect1.bottom < rect2.top ||
|
||||
rect1.top > rect2.bottom)
|
||||
return overlap;
|
||||
}
|
||||
|
||||
findOneVisibleElement(parentNode) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue