Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

189
Visualizações
Issue with getBoundingClientRect()

i have trouble with a slider on codepen. i have implemented it on my website and recognised that the white highligter of the content is moving if im scrolling on the website. The white highlighter is moving up and down. I really dont know how to fix that. The original code have also the same issue. Maybe someone have an idea? The Code is on codepen.io/JavaScriptJunkie/pen/ZMMRRQ

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

getBoundingClientRect() provides the coordinates for the rectangle currently in view on screen. By simply adding window.pageYOffset (the is the height above the viewport to the top of the page) to the new Y coordinate you can offset this shifting Y position.

See 16 in this fork of your Codepen: https://codepen.io/yoat/pen/XWzqRKJ

var x = this.getBoundingClientRect().left;
// only the y position changes, not the X or the height!
var y = this.getBoundingClientRect().top + window.pageYOffset;
var width = this.getBoundingClientRect().width;
var height = this.getBoundingClientRect().height;
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda