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

203
Vistas
I have the scroll behavior set to smooth in CSS but how to write it in JS?

I've set the scroll functionality to smooth using CSS

scroll-behavior: smooth

I've been told it can be done using scrollIntoView or scrollTo, but I am a bit beginner to this. How do I turn that to pure JS?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

scroll-behavior CSS property make the contents within an element scroll smoothly. While Element.scrollIntoView is used to programmatically scroll to an element.

If you want for example scroll to the header of the page with scroll-behavior: smooth you can opt-in the behavior option and set it to smooth.

var header = document.getElementById("header")
header.scrollIntoView({ behavior: "smooth" })
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