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

140
Views
La actualización de la posición del elemento en DOM sobre el desplazamiento se retrasa cuando el desplazamiento suave está habilitado

Estoy tratando de agregar un elemento SVG al lado de las etiquetas de formulario con posición absoluta. Cuando hay un desplazamiento, escucho el evento de desplazamiento y actualizo la posición del SVG. Cuando se habilita el desplazamiento suave, el SVG tiende a rebotar sobre el desplazamiento continuo. Este rebote se observa en macOS Chrome y en FireFox cuando el desplazamiento suave está habilitado.

En Linux/Windows, esto se puede reproducir utilizando la extensión de cromo de desplazamiento suave .

Capturé el rebote debido al desplazamiento en esta grabación.

rebote debido al desplazamiento

 function updateCoords(smartTip, refElement) { let clientRect = refElement.getBoundingClientRect(); smartTip.top = clientRect.top; smartTip.left = clientRect.left; let element = smartTip.element; let position = getRightPosition(refElement); let top = position[0]; let left = position[1]; let diffX = left - smartTip.prevLeft + "px"; let diffY = top - smartTip.prevTop + "px"; element.style.transform = "translate(" + diffX + "," + diffY + ")"; } function setOnScrollListener(element) { let scrollHandler = function (e) { let inputElements = document.getElementsByTagName("label"); for (let i = 0; i < customElements.length; i++) { customElements[i].element.style.display = "inline"; updateCoords(customElements[i], inputElements[i]); } }; element.addEventListener("scroll", scrollHandler, true); }

enlace a jsfiddle

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