Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

115
Views
¿Cómo puedo desplazarme hacia la vista/enfoque sin la animación de desplazamiento suave? como enfocarse instantáneamente en un elemento

Intenté configurar el behavior: 'instant' en las opciones de scrollIntoView , pero no funcionó, y también preventScroll: false para las opciones de focus , pero aún se desplaza suavemente para llegar al elemento.

en esta página https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus en el último fragmento de código, se comporta como lo que quiero, instantáneamente se enfoca en el elemento, sin la animación de desplazamiento , pero para mí, siempre se desplaza suavemente hasta llegar al elemento, ¿cómo puedo desactivar esa animación de desplazamiento?

 // Show next page function showNextPage() { let currPage = parseInt(pageCounter.textContent); let target = document.querySelector(`[data-page="${currPage + 1}"]`); target.focus({ preventScroll: false }); // DIDN"T WORK } // Show next page function showNextPage() { let currPage = parseInt(pageCounter.textContent); let target = document.querySelector(`[data-page="${currPage + 1}"]`); target.scrollIntoView({ behavior: 'instant' }); // DIDN"T WORK }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

scrollIntoView sin parámetro debería desplazarse instantáneamente.

 function showNextPage() { let currPage = parseInt(pageCounter.textContent); let target = document.querySelector(`[data-page="${currPage + 1}"]`); target.scrollIntoView(); }

Además, debe eliminar scroll-behavior: smooth si tiene alguno en el CSS de su elemento. Eso también podría causar un desplazamiento suave.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!