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

298
Views
¿Cómo ir a una sección en particular sin comportamiento de desplazamiento/alguna alternativa a scrollIntoView() sin comportamiento de desplazamiento?

Estoy tratando de crear una redirección de página a una sección en particular, es decir, quiero ir a un div de anclaje en particular en una página sin comportamiento de desplazamiento. Sin embargo, tengo una cadena de consulta en la URL para la paginación, por lo que el método #id falló. Intenté "scrollIntoView()" pero contiene el comportamiento de desplazamiento de página, que no es deseado. ¿Puedo preguntar si hay alguna solución alternativa a este problema?

Estoy usando Vue para el frontend y Codeigniter para el backend. Aquí está mi código:

 mounted() { // anchorPageToProductList if (this.isOnQuery) { console.log('isOnQuery'); this.scrollToProductList(); } else { console.log('isNotOnQuery'); } },
 methods: { scrollToProductList(){ window.addEventListener('DOMContentLoaded', () => { // scroll animation document.getElementById('product-list-anchor').scrollIntoView(true); }); },

Ejemplo de mi caso de URL:

 http://www.example.com/Product/list?search=&sort=3&type=-1&event%5B%5D=11&pagination=1

¡¡Gracias!!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Intenté desactivar el comportamiento de desplazamiento, permitir que la página salte a la sección deseada y luego restablecer el comportamiento de desplazamiento suave. Así que ahora funciona sin el comportamiento de desplazamiento. Gracias por todos los comentarios:)

Mi código:

 scrollToProductList(){ window.addEventListener('DOMContentLoaded', () => { // select the whole html & disable smooth-scroll behavior in css let htmlElement = document.querySelector('html'); htmlElement.style.scrollBehavior = 'auto'; // go to the anchor point document.getElementById('product-list-anchor').scrollIntoView(true); // enable smooth-scroll behavior again htmlElement.style.scrollBehavior = 'smooth'; }); }
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!