|
|
|
@ -60,7 +60,7 @@ export class SliderContainerComponent implements OnInit, OnDestroy, AfterContent
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnDestroy() {
|
|
|
|
|
if(this.observer) {
|
|
|
|
|
if(this.observer && typeof IntersectionObserver !== 'undefined') {
|
|
|
|
|
this.observer.disconnect();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -78,24 +78,26 @@ export class SliderContainerComponent implements OnInit, OnDestroy, AfterContent
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setObserver() {
|
|
|
|
|
let options = {
|
|
|
|
|
root: null,
|
|
|
|
|
rootMargin: '0px',
|
|
|
|
|
threshold: 0.1
|
|
|
|
|
};
|
|
|
|
|
this.observer = new IntersectionObserver(entries => {
|
|
|
|
|
entries.forEach(entry => {
|
|
|
|
|
if (entry.isIntersecting && !this.initialized) {
|
|
|
|
|
this.stopped = false;
|
|
|
|
|
this.start(0);
|
|
|
|
|
this.initialized = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.initialized = false;
|
|
|
|
|
this.stopped = true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}, options);
|
|
|
|
|
this.observer.observe(this.element.nativeElement);
|
|
|
|
|
if(typeof IntersectionObserver !== 'undefined') {
|
|
|
|
|
let options = {
|
|
|
|
|
root: null,
|
|
|
|
|
rootMargin: '0px',
|
|
|
|
|
threshold: 0.1
|
|
|
|
|
};
|
|
|
|
|
this.observer = new IntersectionObserver(entries => {
|
|
|
|
|
entries.forEach(entry => {
|
|
|
|
|
if (entry.isIntersecting && !this.initialized) {
|
|
|
|
|
this.stopped = false;
|
|
|
|
|
this.start(0);
|
|
|
|
|
this.initialized = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.initialized = false;
|
|
|
|
|
this.stopped = true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}, options);
|
|
|
|
|
this.observer.observe(this.element.nativeElement);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
start(time: number) {
|
|
|
|
|