Skip to content

Carousel effect feature #689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Please be aware that the demos may exhibit significant accessibility issues, suc
- [Carousel](#carousel)
- [Compass Loader](#compass-loader)
- [City Animation Footer](#city-animation-footer)
- [Carousel Effect](#carousel-effect)
- [Counter of Checked Checkboxes](#counter-of-checked-check-boxes)
- [Download_buttons](#Download_buttons)
- [Dog Box Animation](#dog-box-animation)
Expand Down Expand Up @@ -1012,6 +1013,16 @@ Please be aware that the demos may exhibit significant accessibility issues, suc

---

## <a id="carousel-effect"></a>Carousel Effect


[Download the demo video](https://raw.githubusercontent.com/amrutha-m206/You-Dont-Need-JavaScript/carousel_effect-feature/images/carousel_demo.mp4)




**[⬆ back to top](#quick-links)**

## Contributors

Thanks to these wonderful people who have contributed to this project!
Expand Down
Binary file added carousel_effect/img1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added carousel_effect/img2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added carousel_effect/img3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions carousel_effect/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Carousel</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="carousel">
<input type="radio" name="slides" id="slide1" checked>
<input type="radio" name="slides" id="slide2">
<input type="radio" name="slides" id="slide3">

<div class="slides">
<div class="slide" id="image1"><img src="img1.jpg" alt="Image 1"></div>
<div class="slide" id="image2"><img src="img2.jpg" alt="Image 2"></div>
<div class="slide" id="image3"><img src="img3.jpg" alt="Image 3"></div>
</div>

<div class="navigation">
<label for="slide1"></label>
<label for="slide2"></label>
<label for="slide3"></label>
</div>
</div>

</body>
</html>
Binary file added carousel_effect/output/carousel_demo.mp4
Binary file not shown.
68 changes: 68 additions & 0 deletions carousel_effect/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
body{
background-color: rgb(163, 193, 163);
}
.carousel {
position: relative;
width: 80%;
max-width: 800px;
height: 50vh;
margin: 0 auto;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
border-radius: 10px;

}

.slides {
display: flex;
width: 800%;
height: 100%;
transition: transform 1s ease;
animation: slideAnimation 12s infinite;
}

@keyframes slideAnimation {
0%, 33.33% { transform: translateX(0%); }
33.34%, 66.66% { transform: translateX(-100%); }
66.67%, 100% { transform: translateX(-200%); }
}

.slide {
width: 100%;
flex: 1 0 100%;
}

.slide img {
width: 100%;
height: 100%;
object-fit: contain;
}

input[type="radio"] {
display: none;
}

.navigation {
position: absolute;
bottom: 15px;
display: flex;
justify-content: center;
width: 100%;
}

.navigation label {
display: inline-block;
width: 12px;
height: 12px;
margin: 0 6px;
background: #ccc;
border-radius: 50%;
cursor: pointer;
transition: background 0.3s;
}

input[type="radio"]:checked + label {
background: #333;
}