mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-21 21:01:20 -08:00
add autoMin
This commit is contained in:
1 parent
33a7e1193d
commit
b202c21a7f
11 files changed
+150
-18
No files matched your search
@@ -64,3 +64,12 @@ export function tooltip(target, msg, pos = 'up') {
|
||||
target.setAttribute('aria-label', msg);
|
||||
target.setAttribute('data-balloon-pos', pos);
|
||||
}
|
||||
|
||||
export function isInViewport(el) {
|
||||
const rect = el.getBoundingClientRect();
|
||||
const windowHeight = window.innerHeight || document.documentElement.clientHeight;
|
||||
const windowWidth = window.innerWidth || document.documentElement.clientWidth;
|
||||
const vertInView = rect.top <= windowHeight && rect.top + rect.height >= 0;
|
||||
const horInView = rect.left <= windowWidth && rect.left + rect.width >= 0;
|
||||
return vertInView && horInView;
|
||||
}
|
||||
Reference in new issue
Block a user