chore: move utils

This commit is contained in:
chenjiahan
2020-07-05 08:32:49 +08:00
parent 0a4c6676ba
commit 12faaa2179
20 changed files with 776 additions and 2 deletions
+11
View File
@@ -0,0 +1,11 @@
export function isHidden(el: HTMLElement) {
const style = window.getComputedStyle(el);
const hidden = style.display === 'none';
// offsetParent returns null in the following situations:
// 1. The element or its parent element has the display property set to none.
// 2. The element has the position property set to fixed
const parentHidden = el.offsetParent === null && style.position !== 'fixed';
return hidden || parentHidden;
}