add autoMin

This commit is contained in:
Harvey committed 2020-05-19 11:47:45 +08:00
1 parent 33a7e1193d
commit b202c21a7f
11 files changed
+150 -18

No files matched your search

+23
View File
@@ -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;
}
});
}