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

138
Views
Transition a page sideways

I have a website that basically has 2 pages. In total, there is 3 sections, with the first page showing the left and the middle, and the second showing the middle and the right. I'm wondering if there is a simple way to transition horizontally between the 2 pages. It would look something like this with the transition:

enter image description here

An extra problem comes when you need to resize the window. In that case, section A and C should get bigger and the transition should change accordingly while B is fixed width.

enter image description here

I think the best way is to create a single page because the loading breaks the immersion, but if it is simpler to create 2 pages because of the responsive web design then its fine. The easiest way I could think of is to move the user camera sideways, but the responsive web design complicates it.

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

0

Once we know the width of B we can set the whole thing up to be in columns.

This snippet uses grid to do this with the first and third items taking up any remaining space in the viewport.

By using CSS calc to ascertain the amount that has to be translated to move back and forth the whole thing is responsive and will adjust to different viewport/device widths.

* {
  margin: 0;
}

body {
  overflow: hidden;
}

button {
  position: fixed;
  z-index: 1;
}

.container {
  /* set the width of the second item */
  --bW: 200px;
  width: calc(2 * (100vw - var(--bW)) + var(--bW));
  height: 100vh;
  display: grid;
  grid-template-columns: 1fr var(--bW) 1fr;
  transform: translateX(0);
  transition: transform 1s ease;
  overflow: hidden;
}

.slid {
  transform: translateX(calc(-100vw + var(--bW)));
}

.container>* {
  height: 100%;
  display: inline-block;
}

.container> :nth-child(1) {
  background: magenta;
}

.container> :nth-child(2) {
  background: purple;
}

.container> :nth-child(3) {
  background: teal;
}
<button onclick="document.querySelector('.container').classList.toggle('slid');">CLICK ME TO SLIDE</button>
<div class="container">
  <div></div>
  <div></div>
  <div></div>
</div>

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!