Check offscreen element in isElementVisible()

This commit is contained in:
redphx
2024-09-24 20:58:32 +07:00
parent 7ec449160a
commit f5a5a79a82
2 changed files with 2 additions and 2 deletions

View File

@@ -237,7 +237,7 @@ function escapeHtml(html) {
}
function isElementVisible($elm) {
const rect = $elm.getBoundingClientRect();
return !!rect.width && !!rect.height;
return (rect.x >= 0 || rect.y >= 0) && !!rect.width && !!rect.height;
}
function removeChildElements($parent) {
while ($parent.firstElementChild)