Заменила слайдер используя беблиотеку swiper

This commit is contained in:
mimi committed 2025-03-11 17:02:57 +03:00
1 parent 5b46f720c7
commit 2849fdb9cb
4 files changed
+98 -106

No files matched your search

+51 -48
View File
@@ -1,57 +1,60 @@
.slider {
overflow: hidden;
width: 100%;
margin: 0 auto;
position: relative;
}
& .slide-list {
display: flex;
align-items: center;
justify-content: center; /* Центрируем изображения */
gap: 32px; /* Отступ между картинками */
width: max-content;
width: 100%;
height: 100%;
transition: transform 0.5s ease-in-out;
margin: 0 auto;
padding: 10px 100px; /* Добавляем отступы по бокам */
.swiper-slide {
display: flex;
justify-content: center;
align-items: center;
height: 60vh;
@media (max-width: 768px) {
height: 35vh;
}
}
& .slide {
flex: 1 0 50%;
max-width: 50%; /* Ограничение ширины */
position: relative;
display: flex;
justify-content: center; /* Центрируем контент */
.slide-image {
width: 100%;
height: auto;
max-height: 100%;
object-fit: cover;
object-position: center center;
border-radius: 8px;
pointer-events: none;
}
& .slide-image {
display: flex;
max-height: 60vh;
max-width: 100%;
border-radius: 8px;
}
}
/* стрелки */
.swiper-button-prev,
.swiper-button-next {
width: 60px;
height: 60px;
background-color: white;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
cursor: pointer;
&::after {
font-size: 18px;
font-weight: 1000;
color: black;
}
}
/* Медиа-запрос для мобильных устройств */
@media (max-width: 768px) {
.slider {
& .slide-list {
justify-content: left;
gap: 0; /* Убираем лишние отступы */
padding: 0; /* Уменьшаем отступы */
}
& .slide-list .slide {
flex: 1 0 100%; /* Одна картинка в ряд */
max-width: 100%; /* Использует всю ширину */
display: flex;
justify-content: center; /* Центрируем */
}
& .slide-list .slide .slide-image {
max-width: 90%; /* Делаем изображение большим, но с небольшими отступами */
height: auto; /* Сохраняем пропорции */
max-height: 70vh; /* Ограничиваем высоту */
border-radius: 8px;
}
/* Позиционирование стрелок */
.swiper-button-prev {
left: 5px;
@media (max-width: 768px) {
left: 0px;
}
}
}
.swiper-button-next {
right: 5px;
@media (max-width: 768px) {
right: 0px;
}
}