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

133
Vistas
How do I get the scrolling element of current web page?

If the route changes, I want to find the element with scroll on the page I moved and give it window.scrollTo(0,0), how should I find the element?

current code

if (process.client) {
    router.afterEach((to, from) => {
      document.querySelector('.overflow-scroll').scrollTo(0, 0)
    })
  }

The code work well but, I don't want use document.querySelector. I want to find scrolling element when route!

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

0

Make an event listener and a parameter "scroll" in the event listener write predefined functions or keywords just like scrollX or scrollY You can aslo use bottom or top.

scroller.addEventListener("scroll", event => {
  output.textContent = `scrollBy: ${scroller.scrollBy}`;
});

Here is scroll is html class and Id html elements you want to scroll. And output is just show much px you scroll it he is **html class or Id ** you can remove it.

To know or learn in depth.

https://www.w3.org/TR/2016/WD-cssom-view-1-20160317/#dom-element-scrolltop

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