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

167
Views
Get true background color of a transparent element that is positioned absolute

I have a transparent element like that is positioned absolutely

header { position: absolute; top: 0px; width: 100%; }

... and it's on top of a colored div.

How do I get the color of the div below of a absolutely positioned transparent div with javascript?

This is the transparent div (the navbar): enter image description here

This is the navbar when you scroll down a little bit: enter image description here

Feel free to ask any questions.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This sounds like you have to actually capture a "screenshot" and look at how the page is finally rendered. As far as I know, that is the only way.

Basically you would need to check the rendered color of a single pixel. Not knowing why you want to do this is critical in is this necessary or not.

One way to achieve this is to use something like https://html2canvas.hertzen.com to take a screenshot of the rendered page, put that into a <canvas> element and then once you have that, check the color of a pixel you know to be inside the header; check https://jsfiddle.net/ourcodeworld/8swevoxo/ for an example.

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