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

288
Views
How to put one div onto another with transition?

I want to create something such that, depending on the state, a given div appears overlapping another div from the right side, here is my code:

  const [loggedIn, setLoggedIn] = useState<boolean>(false);
  const [hasConfirmedAccount, setHasConfirmedAccount] = useState<boolean>(false);

  return (
    <>
      <div style={{ width: "100%" }}>
        <div style={{ float: "left", width: "50%" }}>
          <div
            style={{ width: "100%", height: "100vh", backgroundColor: "#fafafafa" }}
          ></div>
        </div>

        <div id='notLoggedIn' style={{ float: "right", width: "50%" }}>
          {!loggedIn && (
            <div>
                WHEN LOGGED IN === TRUE
            </div>
          )}

          <div
            style={
              loggedIn && !hasConfirmedAccount 
                ? { width: "100%", transition: "ease-in-out 5s" }
                : { display: "none" }
            }
          >
            <div id="notConfirmedAccount">WHENE LOGGED IN === TRUE AND hasConfirmedAccount === FALSE</div>
          </div>
        </div>
      </div>
    </>
  );

The code works fine, when loggedIn === true and hasConfirmedAccount === false div with id = notConfirmedAccount has been displayed instead of div with id=notLoggedIn, but displaying this div does not work flowing, I want a slow leaving effect of the div on the right side that would overlap the previous div

can someone tell me what to do this?

thanks for any help!

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

0

  1. install animate.css => $ npm install animate.css --save animate.css

2.import "./animate.css" at top your component or project

3.just put the name of aniamte on className like this pattern in your div

<div className={style.forgot} className='animate__animated animate__fadeInDown'>

also you should control your showing div with state

about 4 years ago · Juan Pablo Isaza Report

0

Use React animation Add-Ons ReactTransitionGroup and ReactCSSTransitionGroup

The ReactTransitionGroup add-on component is a low-level API for animation, and ReactCSSTransitionGroup is an add-on component for easily implementing basic CSS animations and transitions.

https://reactjs.org/docs/animation.html

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!