ImageSlider

This commit is contained in:
2024-10-24 14:04:46 +02:00
parent 0526b47ea4
commit 6e020509db
34 changed files with 68 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 737 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 962 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

View File

@ -0,0 +1,16 @@
const files = [];
let current = 0;
for (let i = 1; i <= 30; i++) {
files.push(`(${i}).jpg`);
}
function changeSlide(val){
current += val;
if (current > files.length - 1) {
current = 0;
}
if (current < 0) {
current = files.length - 1;
}
document.getElementById("slided").src = `./IMG/${files[current]}`;
}

View File

@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image Slider</title>
<style>
body {
background-color: grey;
}
.slider {
display: flex;
align-items: center;
justify-content: center;
margin: 10vh auto;
position: relative;
}
.slider #slided {
width: 50vh;
border-radius: 10px;
border: solid 5px black;
}
#arrowleft, #arrowright {
width: 50px;
height: 50px;
cursor: pointer;
}
#arrowleft {
transform: rotate(180deg);
margin-right: 10px;
}
#arrowright {
margin-left: 10px;
}
#slided {
width: 55vh;
height: 70vh;
object-fit: cover;
overflow: hidden;
}
</style>
</head>
<body>
<div class="slider">
<img id="arrowleft" src="./Components/arrow.png" alt="Left Arrow" onclick="changeSlide(-1)">
<img id="slided" src="./IMG/(1).jpg" alt="Slide Image">
<img id="arrowright" src="./Components/arrow.png" alt="Right Arrow" onclick="changeSlide(1)">
</div>
<script src="script.js"></script>
</body>
</html>