script.js?qk13u0:2069 Uncaught ReferenceError: ScrollOut is not defined code example
Example: scrollout js angular
$ npm i scroll-out -S
import ScrollOut from 'scroll-out';
@Component()
export class MyComponent implements AfterContentInit, OnDestroy {
so: any;
constructor(private el: ElementRef) {}
ngAfterContentInit() {
this.so = ScrollOut({
scope: this.el.nativeElement
});
}
ngOnDestroy() {
this.so.teardown();
}
}
[data-scroll] {
transition: opacity 1s;
}
[data-scroll="in"] {
opacity: 1;
}
[data-scroll="out"] {
opacity: 0;
}
<div data-scroll>Watch me fading in!</div>