Skip to content
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

CSS Mem Slider #1

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Binary file added cssMemSlider/images/1.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 cssMemSlider/images/2.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 cssMemSlider/images/3.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 cssMemSlider/images/4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions cssMemSlider/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!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>Mem slider</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<main class="wraper">
<div class="container">
<input type="radio" name="slider" id="slide1" checked />
<input type="radio" name="slider" id="slide2" />
<input type="radio" name="slider" id="slide3" />
<input type="radio" name="slider" id="slide4" />

<div class="slider">
<div class="images__container">
<div class="slide-item">
<img src="./images/1.jpg" alt="meme1" />
</div>
<div class="slide-item">
<img src="./images/2.jpg" alt="meme2" />
</div>
<div class="slide-item">
<img src="./images/3.jpg" alt="meme3" />
</div>
<div class="slide-item">
<img src="./images/4.jpg" alt="meme4" />
</div>
</div>
<div class="description__slider">
<div class="texts__slider">
<p>Барсик-Барсик...</p>
<p>Максимум недовольства</p>
<p>Бикукле!</p>
<p>Кошечка без радостных моментов)</p>
</div>
<div class="navigation__slider">
<label for="slide1" class="label1 label__container"
><span></span
></label>
<label for="slide2" class="label2 label__container"
><span></span
></label>
<label for="slide3" class="label3 label__container"
><span></span
></label>
<label for="slide4" class="label4 label__container"
><span></span
></label>
</div>
</div>
</div>
</div>
</main>
</body>
</html>
163 changes: 163 additions & 0 deletions cssMemSlider/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
*,
*::after,
*::before {
padding: 0;
margin: 0;
border: 0;
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
}

body {
height: 100vh;
background-color: #8fbc8f;
}

.wraper {
background-color: #8fbc8f;
}

.container {
max-width: 100vw;
padding: 2rem;
margin: auto;
}

input {
display: none;
}

.slider {
width: 100%;
}

.images__container {
width: 100%;
margin: auto;
overflow: hidden;
display: flex;
}

.slide-item {
width: 100%;
flex-shrink: 0;
transition: all 0.3s ease;
text-align: center;
}

.slide-item > img {
width: 60%;
object-fit: cover;
}

.description__slider {
display: flex;
}

.texts__slider {
flex: 1;
overflow: hidden;
display: flex;
width: 100%;
}

.texts__slider > p {
font-size: 3.5rem;
width: 100%;
flex-shrink: 0;
transition: all 0.3s ease;
}

/*767px*/
@media screen and (max-width: 47.938rem) {
.texts__slider > p {
font-size: 1.5rem;
padding-top: 1.5rem;
text-align: center;
}
}

.navigation__slider {
flex: 1;
padding-top: 1%;
display: flex;
flex-wrap: wrap;
height: fit-content;
justify-content: center;
}

/*1008px*/
@media screen and (max-width: 63rem) {
.description__slider {
flex-direction: column-reverse;
/*direction: rtl;*/
align-items: center;
}

.navigation__slider {
padding-top: 0.5rem;
}

.texts__slider > p {
font-size: 1.5rem;
padding-top: 1.5rem;
text-align: center;
}
}

.label__container {
padding: 0.5rem;
user-select: none;
display: flex;
justify-content: center;
transition: all 0.3s ease;
}

.label__container:hover span {
background: #008000;
}

.label__container:active span {
background: #00ff00;
}

label {
width: 4rem;
}

span {
width: 2.5rem;
height: 2.5rem;
background-color: #008b8b;
border-radius: 50%;
cursor: pointer;
}

#slide1:checked ~ .slider .label1 span,
#slide2:checked ~ .slider .label2 span,
#slide3:checked ~ .slider .label3 span,
#slide4:checked ~ .slider .label4 span {
background: #fa8072;
border: 2px solid #fff;
transform: scale(1.2);
}

#slide1:checked ~ .slider .slide,
#slide1:checked ~ .slider p {
transform: translateX(0);
}

#slide2:checked ~ .slider .slide-item,
#slide2:checked ~ .slider p {
transform: translateX(-100%);
}

#slide3:checked ~ .slider .slide-item,
#slide3:checked ~ .slider p {
transform: translateX(-200%);
}

#slide4:checked ~ .slider .slide-item,
#slide4:checked ~ .slider p {
transform: translateX(-300%);
}