I was told it can be done via javascript but I wasn’t able to figure it out.
How would I do that here with this code? https://jsfiddle.net/czqa3Lds/
Something like this I was thinking. https://jsfiddle.net/5bj72hd1/
I tried different things and wasn’t able to do it.
That is all I am trying to do here, reduce duplication of the images.
<div class="container">
<div class="panel-left">
<div class="inner">
<div class="container2" id="container2-left">
<!-- Images will be inserted here by JavaScript -->
</div>
</div>
</div>
<div class="panel-right">
<div class="inner">
<div class="container2" id="container2-right">
<!-- Images will be inserted here by JavaScript -->
</div>
</div>
</div>
</div>
html,
body {
margin: 0;
padding: 0;
}
body {
background: #121212;
padding: 50px 8px;
}
.panel-left,
.panel-right {
position: fixed;
height: 100%;
width: 50%;
top: 0%;
overflow: hidden;
z-index: 0;
transform: translateX(0);
transition: transform 7s cubic-bezier(0.645, 0.045, 0.355, 1);
transition-delay: 1s;
}
.panel-left {
left: 0;
}
.panel-right {
right: 0;
}
.panel-left::before,
.panel-right::before {
content: "";
position: fixed;
height: 100%;
width: 200%;
top: 0;
left: 0;
}
.panel-right::before {
left: -100%;
}
.container:hover .panel-left {
transform: translateX(-100%);
}
.container:hover .panel-right {
transform: translateX(100%);
}
.inner {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
width: 200%;
position: absolute;
left: 0;
z-index: 2;
}
.panel-right .inner {
left: -100%;
}
.container2 {
max-width: 360px;
border: 1px solid #ccc;
}
.container2 div {
display: flex;
justify-content: center;
}
.container2 img {
display: block;
margin: auto;
width: 33.33%;
height: auto;
}
<div class="container">
<div class="panel-left">
<div class="inner">
<div class="container2">
<img src="https://i.imgur.com/z5MMJnv.png" alt="Image 1">
<div>
<img src="https://i.imgur.com/5u16syR.png" alt="Image 2">
<img src="https://i.imgur.com/ygTtvme.png" alt="Image 3">
<img src="https://i.imgur.com/QziKNDW.png" alt="Image 4">
</div>
<img src="https://i.imgur.com/8Jf8LLc.png" alt="Image 5">
</div>
</div>
</div>
<div class="panel-right">
<div class="inner">
<div class="container2">
<img src="https://i.imgur.com/z5MMJnv.png" alt="Image 1">
<div>
<img src="https://i.imgur.com/5u16syR.png" alt="Image 2">
<img src="https://i.imgur.com/ygTtvme.png" alt="Image 3">
<img src="https://i.imgur.com/QziKNDW.png" alt="Image 4">
</div>
<img src="https://i.imgur.com/8Jf8LLc.png" alt="Image 5">
</div>
</div>
</div>
</div>
3
Answers