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

153
Vistas
Slow down scrolling speed

I have 3 tabs on the ui. As the user scrolls down the second tab is shown and then the third tab. However, the tabs scrolling speed is fast, so as soon as the user scrolls from 1st tab, 3rd tab is seen. Please help me to slow the process so that the 2nd tab is seen

function checkPosition(){
      var div1 = $("section.u3gm-header");
      var div2 = $('section.u3m-slider-top-tabs');
      var div1_top = div1.offset().top;
      var div2_top = div2.offset().top;
      var div1_bottom = div1_top + div1.height();
      var div2_bottom = div2_top + div2.height();
      return [div1_bottom, div2_top, div1_top, div2_bottom];
    
    }
    var lastScrollTop = 0;
    
    $(window).scroll(function() {
        var st = $(this).scrollTop();
        let [div1_bottom, div2_top, div1_top, div2_bottom] = checkPosition();
        if (st > lastScrollTop){
            if (div1_bottom >= div2_top && div1_top < div2_bottom) {
              console.log(slider.index);
              if (slider.index >= slider.slideIds.length - 1) {
                slider.index = slider.slideIds.length - 1;
              }else{
                console.log(slider.index);
                  slider.index += 1;
                  slideTo(slider.index);
              }
            } else {
                $("#result").html("");
            }
        }else{
          if (Math.floor(div1_bottom) <= Math.floor(div2_top) && div1_top < div2_bottom) {
            if (slider.index <= 0) {
              slider.index = 0;
            }else{
            slider.index -= 1;
              slideTo(slider.index);
            }
    
          }
        }
    });
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

This might help.

From MDN documentation of scrollIntoView You can pass in option instead of boolean.

scrollIntoViewOptions Optional
A Boolean or an object with the following options:
{
  behavior: "auto"  | "instant" | "smooth",
  block:    "start" | "center" | "end" | "nearest",
  inline:    "start" | "center" | "end" | "nearest",
}

So you can simply pass parameter like this.

{
  const element = document.getElementById(id);
  element.scrollIntoView({ block: 'end',  behavior: 'smooth' });
}

This will cause the elements to scroll slow.

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