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

105
Vistas
Trigger IntersectionObserver before in view

I'm trying to do a simple infinite scroller, but I really can't get it to trigger BEFORE the footer on the page is visible. Is it possible?

I thought setting the rootMargin would do it, but the observer function does not seem to get fired.

I'm using VueJS. Here is part of the footer component:

      mounted () {
        this.observer = new IntersectionObserver(this.handleIntersect, {
          root: null,
          rootMargin: '500px 0px',
          threshold: 0,
        })
        this.observer.observe(this.$el)
      },

      destroyed () {
        this.observer?.disconnect()
      },

      methods: {
        handleIntersect ([entry]) {
          console.log('entry:', entry.boundingClientRect.top)
        }
      },
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I couldn't figure out a way to do this, so I worked around it by making the element position:relative and adding an element position:absolute top:-500px left:0 bottom:-500px right:0 and putting the IntersectionObserver on that instead

<div class="position:relative">
    <div style="position:absolute;top:-500px;left:0;bottom:-500px;right:0;transform:scale(150%);pointer-events:none;"></div>
    … content
</div>
about 4 years ago · Juan Pablo Isaza Denunciar
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