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

290
Vistas
Smooth scroll when setting CSS element in jQuery

I'm dynamically setting some CSS attributes on an element in jQuery and it seems like the animation is quite choppy and detracts from the user experience:

enter image description here

This is the code where I set the CSS attributes via jQuery:

  updateValue = _.debounce(() => {
    var scroll = $(window).scrollTop();
    $("#tableBody").css("visibility", "hidden");

    if ($("#div1").offset() && scroll >= $("#div1").offset().top) {
      $("#idHeader tr th").css("top", scroll - $("#div1").offset().top - 10);
    } else {
      $("#idHeader tr th").css("top", 0);
    }

    $("#tableBody").css("visibility", "visible");
  }, 1);

  handleScroll = () => {
    this.updateValue();
  };

This is my HTML element:

  <div style={{ overflowX: "scroll" }}>
    <div id="div1" className="container">
      <table className="odds-table">
        <thead id="idHeader">
          <tr>
            <th style={{ padding: 10 }}></th>
            {this.renderSportsbooks(marketOdds)}
          </tr>
        </thead>
        <tbody id="tableBody">{this.renderOdds(marketOdds)}</tbody>
      </table>
    </div>
  </div>

How can I get the element to scroll to be less choppy?

about 4 years ago · Juan Pablo Isaza
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