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

294
Views
Is it possible to make a non-child element be affected by overflow hidden? If not, what are some work arounds?

I'm trying to create an overlay with a white sidebar and header that begin changing color to black when an expander starts filling the screen. The expander fills the screen from the center so parts of the header and sidebar should be black while the parts not covered by the expander should be white.

So far, I have tried positioning a duplicate header/sidebar with the desired properties inside of the expander div but the scaling and positioning ended up being a nightmare as I used JS to apply a transform property on the expander, resulting in the nested elements expanding as well.

The current best approach that I came up with is to somehow use overflow hidden and position the sidebar and header outside of the expander but I'm now running into the problem of the overflow not affecting the duplicate sidebar/header because they're not children of the expander.

Is there a way around this or is my architecture just no good?

Edit: added some code

Expander is inside a container called scroll2. Scroll2 is just the second scroll component of the website.

<div id="scroll2">
            <div id="scroll2Box" />
            <div id="expander" />
            <div id="scroll2BoxImages" />
</div>

Expander CSS

#expander {
  position: fixed;
  top: 0;
  height: 100vh;
  width: 100vw;
  background: black;
  right: 0;
  z-index: 1;
  transform: scale(0);
  overflow: hidden;
}

Expander's transform style changes based on the user's scroll position.

document.getElementById('expander').style.transform = 'scale(' + String(heightRatio) + ')'

My header and sidebar components are outside of the scroll entirely and are placed in my router logic area.

<Router>
    <Sidebar yPosition={y} direction={direction}/>
    <Header yPosition={y}/>
    <div id="mainContent">
        <Switch>
            <Route exact path="/" component={HomePage} />
            <Route path="/about" component={AboutPage} />
            <Route path="/contact" component={ContactPage} />
            <Route path="/products" component={ProductsPage} />
       </Switch>
    </div>
    {/* <Footer /> not complete yet */}
</Router>
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!