diff --git a/apps/NwaifuAnime/src/app/components/reader/lazyscroll.directive.ts b/apps/NwaifuAnime/src/app/components/reader/lazyscroll.directive.ts new file mode 100644 index 0000000..09fb31c --- /dev/null +++ b/apps/NwaifuAnime/src/app/components/reader/lazyscroll.directive.ts @@ -0,0 +1,19 @@ +import { Directive, ElementRef } from "@angular/core"; + +@Directive({ + selector: "[appLazyLoad]", + standalone: true, +}) +export class LazyLoadDirective { + constructor({ nativeElement }: ElementRef) { + const observer = new IntersectionObserver( + (entries) => { + console.log(entries); + }, + { + rootMargin: "1000px", + }, + ); + observer.observe(nativeElement); + } +} diff --git a/apps/NwaifuAnime/src/app/components/reader/reader.component.html b/apps/NwaifuAnime/src/app/components/reader/reader.component.html index 7e14264..4226a99 100644 --- a/apps/NwaifuAnime/src/app/components/reader/reader.component.html +++ b/apps/NwaifuAnime/src/app/components/reader/reader.component.html @@ -21,6 +21,7 @@ } } +