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

75
Views
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
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!