Как реализовать таким образом, чтобы при нажатии на L все картинки смещались влево, а при нажатии на R наоборот?
const hamburger_menu = document.querySelector(".hamburger-menu");
const container = document.querySelector(".container");
const bottom = document.querySelector(".bottom");
hamburger_menu.addEventListener("click", () => {
container.classList.toggle("active");
bottom.classList.toggle("show");
});
const arrow_right = document.querySelector(".right");
const main = document.querySelector(".main");
const shadow_one = document.querySelector(".one");
const shadow_two = document.querySelector(".two");
arrow_right.addEventListener("click", () => {
shadow_one.style.transform = "perspective(1300px) rotateY(20deg) translateZ(310px) scale(0.5)";
shadow_one.style.left = "350px";
shadow_one.style.zIndex = "3";
shadow_two.style.transform = "perspective(1300px) rotateY(20deg) translateZ(215px) scale(0.5)";
shadow_two.style.left = "100px";
shadow_two.style.zIndex = "2";
main.style.transform = "perspective(1300px) rotateY(20deg) translateZ(120px) scale(0.5)";
main.style.left = "-25px";
main.style.zIndex = "1";
});
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700;800;900&display=swap');
*{
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: 'Orbitron', sans-serif;
}
img{
position: absolute;
width: 600px;
height: auto;
left: 50%;
transform: translateX(-50%);
z-index: 1;
}
.container{
min-height: 100vh;
width: 100%;
background-color: #485461;
background-image: linear-gradient(135deg, #485461 0%, #28313b 74%);
overflow-x: hidden;
transform-style: preserve-3d;
}
.navbar{
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 10;
}
.hamburger-menu{
height: 4rem;
width: 2rem;
cursor: pointer;
display: flex;
float: right;
margin-right: 150px;
align-items: center;
justify-content: flex-end;
}
.bar{
width: 2rem;
height: 1.5px;
border-radius: 2px;
background-color: #eee;
transition: 0.5s;
position: relative;
}
.bar:before,
.bar:after {
content: "";
position: absolute;
width: inherit;
height: inherit;
background-color: #eee;
transition: 0.5s;
}
.bar:before {
transform: translateY(-9px);
}
.bar:after {
transform: translateY(9px);
}
.main{
position: relative;
width: 100%;
left: 0;
z-index: 5;
overflow: hidden;
transform-origin: left;
transform-style: preserve-3d;
transition: 0.5s;
}
header{
min-height: 100vh;
width: 100%;
background-color: grey;
}
.overlay{
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
display: flex;
justify-content: center;
align-items: center;
}
.container.active .bar{
transform: rotate(360deg);
background-color: transparent;
}
.container.active .bar:before{
transform: translateY(0) rotate(45deg);
}
.container.active .bar:after{
transform: translateY(0) rotate(-45deg);
}
.container.active .main{
animation: main-animation 0.5s ease;
left: 350px;
cursor: pointer;
transform: perspective(1300px) rotateY(20deg) translateZ(310px) scale(0.5);
}
@keyframes main-animation{
from{
transform: translate(0);
}
to{
transform: perspective(1300px) rotateY(20deg) translateZ(310px) scale(0.5);
}
}
.links{
position: absolute;
width: 20%;
right: 0;
top: 0;
height: 100vh;
z-index: 2;
display: flex;
justify-content: center;
align-items: center;
}
ul{
list-style: none;
}
.links a{
text-decoration: none;
color: #fcec0c;
padding: 0.7rem 0;
display: inline-block;
font-size: 1rem;
font-weight: 300;
text-transform: uppercase;
letter-spacing: 1px;
transition: 0.3s;
opacity: 0;
transform: translateY(10px);
animation: hide 0.5s forwards ease;
}
.links a:hover{
color: #978d01;
}
.container.active .links a{
animation: appear 0.5s forwards ease var(--i);
}
@keyframes appear{
from{
opacity: 0;
transform: translateY(10px);
}
to{
opacity: 1;
transform: translateY(0px);
}
}
@keyframes hide{
from{
opacity: 1;
transform: translateY(0px);
}
to{
opacity: 0;
transform: translateY(10px);
}
}
.shadow{
position: absolute;
width: 100%;
height: 100vh;
top: 0;
left: 0;
transform-style: preserve-3d;
transform-origin: left;
transition: 0.5s;
background-color: white;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
.shadow.one{
z-index: -1;
background-color: red;
}
.shadow.two{
z-index: -2;
background-color: blue;
}
.container.active .shadow.one{
animation: shadow-one 0.6s ease-out;
left: 100px;
transform: perspective(1300px) rotateY(20deg) translateZ(215px) scale(0.5);
}
@keyframes shadow-one{
0%{
transform: translate(0);
}
5%{
transform: perspective(1300px) rotateY(20deg) translateZ(310px) scale(0.5);
}
100%{
transform: perspective(1300px) rotateY(20deg) translateZ(215px) scale(0.5);
}
}
.container.active .shadow.two{
animation: shadow-two 0.6s ease-out;
left: -25px;
transform: perspective(1300px) rotateY(20deg) translateZ(120px) scale(0.5);
}
@keyframes shadow-two{
0%{
transform: translate(0);
}
20%{
transform: perspective(1300px) rotateY(20deg) translateZ(310px) scale(0.5);
}
100%{
transform: perspective(1300px) rotateY(20deg) translateZ(120px) scale(0.5);
}
}
.container.active .main:hover + .shadow.one{
transform: perspective(1300px) rotateY(20deg) translateZ(230px) scale(0.5);
}
.container.active .main:hover{
transform: perspective(1300px) rotateY(20deg) translateZ(340px) scale(0.5);
}
.bottom{
position: relative;
width: 100%;
height: 150px;
display: none;
}
.show{
display: flex;
justify-content: center;
align-items: center;
top: -125px;
}
.arrow{
font-size: 64px;
margin: 0 200px;
cursor: pointer;
z-index: 10;
border-radius: 50%;
color: #fcec0c;
}
.arrow:hover .far{
color: #978d01;
}
<img src="Image/header.png" alt="">
<div class="container">
<div class="navbar">
<div class="hamburger-menu">
<div class="bar"></div>
</div>
</div>
<div class="main-container">
<div class="main">
<header>
<div class="overlay"></div>
</header>
</div>
<div class="shadow one"></div>
<div class="shadow two"></div>
<div class="bottom">
<div class="arrow left">L</div>
<div class="arrow right">R</div>
</div>
</div>
<div class="links">
<ul>
<li>
<a href="#" style="--i: 0.05s;">Home</a>
</li>
<li>
<a href="#" style="--i: 0.1s;">Services</a>
</li>
<li>
<a href="#" style="--i: 0.15s;">Portfolio</a>
</li>
<li>
<a href="#" style="--i: 0.2s;">Testimonials</a>
</li>
</ul>
</div>
</div>