Add files via upload
BIN
100_projects/91-rotating-image-gallery/1.jpg
Normal file
After Width: | Height: | Size: 61 KiB |
BIN
100_projects/91-rotating-image-gallery/2.jpg
Normal file
After Width: | Height: | Size: 64 KiB |
BIN
100_projects/91-rotating-image-gallery/3.jpg
Normal file
After Width: | Height: | Size: 137 KiB |
BIN
100_projects/91-rotating-image-gallery/4.jpg
Normal file
After Width: | Height: | Size: 125 KiB |
BIN
100_projects/91-rotating-image-gallery/5.jpg
Normal file
After Width: | Height: | Size: 89 KiB |
BIN
100_projects/91-rotating-image-gallery/6.jpg
Normal file
After Width: | Height: | Size: 165 KiB |
BIN
100_projects/91-rotating-image-gallery/7.jpg
Normal file
After Width: | Height: | Size: 67 KiB |
BIN
100_projects/91-rotating-image-gallery/8.jpg
Normal file
After Width: | Height: | Size: 29 KiB |
43
100_projects/91-rotating-image-gallery/index.html
Normal file
@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Document</title>
|
||||
<link rel="stylesheet" href="style.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="image-container">
|
||||
<span style="--i: 1">
|
||||
<img src="1.jpg" />
|
||||
</span>
|
||||
<span style="--i: 2">
|
||||
<img src="2.jpg" />
|
||||
</span>
|
||||
<span style="--i: 3">
|
||||
<img src="3.jpg" />
|
||||
</span>
|
||||
<span style="--i: 4">
|
||||
<img src="4.jpg" />
|
||||
</span>
|
||||
<span style="--i: 5">
|
||||
<img src="5.jpg" />
|
||||
</span>
|
||||
<span style="--i: 6">
|
||||
<img src="6.jpg" />
|
||||
</span>
|
||||
<span style="--i: 7">
|
||||
<img src="7.jpg" />
|
||||
</span>
|
||||
<span style="--i: 8">
|
||||
<img src="8.jpg" />
|
||||
</span>
|
||||
</div>
|
||||
<div class="btn-container">
|
||||
<button class="btn" id="prev">Prev</button>
|
||||
<button class="btn" id="next">Next</button>
|
||||
</div>
|
||||
<script src="index.js"></script>
|
||||
</body>
|
||||
</html>
|
26
100_projects/91-rotating-image-gallery/index.js
Normal file
@ -0,0 +1,26 @@
|
||||
const imageContainerEl = document.querySelector(".image-container");
|
||||
|
||||
const prevEl = document.getElementById("prev");
|
||||
const nextEl = document.getElementById("next");
|
||||
let x = 0;
|
||||
let timer;
|
||||
prevEl.addEventListener("click", () => {
|
||||
x = x + 45;
|
||||
clearTimeout(timer);
|
||||
updateGallery();
|
||||
});
|
||||
nextEl.addEventListener("click", () => {
|
||||
x = x - 45;
|
||||
clearTimeout(timer);
|
||||
updateGallery();
|
||||
});
|
||||
|
||||
function updateGallery() {
|
||||
imageContainerEl.style.transform = `perspective(1000px) rotateY(${x}deg)`;
|
||||
timer = setTimeout(() => {
|
||||
x = x - 45;
|
||||
updateGallery();
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
updateGallery();
|
59
100_projects/91-rotating-image-gallery/style.css
Normal file
@ -0,0 +1,59 @@
|
||||
body {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
height: 100vh;
|
||||
justify-content: center;
|
||||
background-color: #b6a35f;
|
||||
overflow: hidden;
|
||||
}
|
||||
.image-container {
|
||||
position: relative;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
transform-style: preserve-3d;
|
||||
transform: perspective(1000px) rotateY(0deg);
|
||||
transition: transform 0.7s;
|
||||
}
|
||||
.image-container span {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
transform: rotateY(calc(var(--i) * 45deg)) translateZ(400px);
|
||||
}
|
||||
.image-container span img {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 200px;
|
||||
height: 150px;
|
||||
}
|
||||
.btn-container {
|
||||
position: relative;
|
||||
width: 80%;
|
||||
}
|
||||
.btn {
|
||||
position: absolute;
|
||||
bottom: -80px;
|
||||
background-color: #aac388;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 10px 20px;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
transition: .3s;
|
||||
font-size: 18px;
|
||||
}
|
||||
.btn:hover {
|
||||
filter: brightness(1.5);
|
||||
color: #000;
|
||||
}
|
||||
#prev {
|
||||
left: 20%;
|
||||
}
|
||||
#next {
|
||||
right: 20%;
|
||||
}
|