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

284
Vistas
Svelte can't find .ScrollTop of a variable

Hello I have an element which is being referenced to the script like this

<div bind:this={AboutMeAnimation} />

and then In my script I console log ScrollTop value

    let AboutMeAnimation;
    console.log(AboutMeAnimation.ScrollTop);

and for some resson I'm getting an error can some one tell me why?enter image description here

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

A couple of issues, the first is that is scrollTop with a lowercase “s”, the other is that the element does not bind immediately so if you are putting this statement at the top level of the component it will be undefined for some period of time. You can use onMount or similar to get this value:

onMount(() => {
  console.log(AboutMeAnimation.scrollTop);
});

Otherwise a reactive statement could work also:

$: {
  console.log(AboutMeAnimation && AboutMeAnimation.scrollTop);
}

Hopefully that helps!

about 4 years ago · Santiago Gelvez 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