Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

222
Vistas
IntersectionObserver for Infinite Scrolling > how to keep fetching more until IsIntersecting is false

In learning the IntersectionObserver api I'm encountering a (seemlingly very basic) scenario that I can't figure out how to handle, and nothing I've read so far has addressed it.

I don't think the specifics matter here -- I think it's a conceptual thing I'm not getting -- so I'm going to put this in generic terms.

The Problem: When I first load my infinitely scrolling screen an initial x number of entries are fetched and rendered on screen. All good. If my bottom sentinel is still intersecting the viewport after this, a second fetch is made and the new entries are added. Still good. However, at this point if my sentinel is still intersecting the viewport (i.e. not enought entries have been added to shove it offscreen) I'm stuck. There are no scroll bars so I can't scroll down and nothing further is fetched. If I resize the window such that the sentinel disappears offscreen and then scroll down, more is fetched.

My Question: So how do I ensure that on an initial load my infinitely scrolling screen gets "filled up" with entries and the sentinel is shoved off screen? Is there a way I can implement some kind of "while entry.IsIntersecting" logic?

Here's how I'm initializing the observer (this is in an Angular component's ngOnInit() but I don't think that's relevant)...

    const options = {
        rootMargin: '0px 0px 0px 0px' 
    };

    this.observer = new IntersectionObserver((entries) => {
        entries.forEach((entry) => {
            if (entry.isIntersecting) {
                this.loadMore.emit(entry);
            }
        });
    }, options);
    this.observer.observe(this.infiniteScrollSentinal.nativeElement);
    

Thank you

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda