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

76
Visualizações
coordinates in document space after scrolling

I want to place a div in an exact location on the page, via d3.js

For that, I use

let p = svg.createSVGPoint();
p.x = 0;
p.y = event_desc_pos_y;
let pt = p.matrixTransform(p.getScreenCTM());
let event_desc_div = d3.select('#event_description_div')
                            .style('top', pt.y + 'px')
                            .style('left', pt.x + 'px')
                            .style('width', width + 'px');

where I also have

#event_description_div {
  position:absolute;
  top: 50px;
  left:50px;
  overflow-y: scroll;
  height: 100px;
}

however, when I have scrolled down the page, this code seems to position this div wildly out of place.

I'm not sure what it is doing since it doesn't look like it places it within the page in absolute terms but also not even relatively on the viewed page (the position goes up in the page as I scroll down)

pt.y and pl.x do not change.

In any case, it doesn't work. The placement depends heavily on the scrolling.

How can I place the div always in the exact same place regardless of whether the page has been scrolled or not?

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