mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 14:41: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
@@ -0,0 +1,23 @@
|
||||
import { debounce, isInViewport } from '../utils';
|
||||
|
||||
export default function viewInit(art, events) {
|
||||
const {
|
||||
player,
|
||||
option: { autoMin },
|
||||
template: { $container },
|
||||
} = art;
|
||||
|
||||
const scrollFn = debounce(() => {
|
||||
art.emit('view', isInViewport($container));
|
||||
}, 200);
|
||||
|
||||
events.proxy(window, 'scroll', () => {
|
||||
scrollFn();
|
||||
});
|
||||
|
||||
art.on('view', (state) => {
|
||||
if (autoMin) {
|
||||
player.min = !state;
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user