Слайдер

This commit is contained in:
vsevolod22 committed 2025-05-26 00:45:06 +03:00
1 parent 95139b4901
commit 487bd14b04
10 files changed
+506 -367

No files matched your search

+211 -99
View File
@@ -1,136 +1,248 @@
.slider {
width: 100%;
margin: 0 auto;
position: relative;
padding: 10px 0;
width: 100%;
margin: 0 auto;
position: relative;
padding: 10px 0;
user-select: none; // Запрещаем выделение всего содержимого слайдера
&.has-pagination {
.swiper {
padding-bottom: 40px;
}
&.has-pagination {
.swiper {
padding-bottom: 40px;
}
}
.swiper-slide {
display: flex;
justify-content: center;
align-items: center;
.slider-item {
display: flex;
justify-content: center;
align-items: center;
.slide-image {
width: 100%;
height: auto;
height: 350px;
object-fit: cover;
object-position: center center; //
border-radius: 8px;
pointer-events: none;
}
.slide-image {
width: 100%;
height: auto;
height: 350px;
object-fit: cover;
object-position: center center;
border-radius: 8px;
pointer-events: none;
user-select: none; // Дополнительная защита от выделения изображений
}
}
.swiper-wrapper:has(.swiper-slide.single) {
justify-content: center;
.swiper-wrapper:has(.swiper-slide.single) {
justify-content: center;
.swiper-slide.single {
display: flex;
justify-content: center;
align-items: center;
.slider-item.single {
display: flex;
justify-content: center;
align-items: center;
.slide-image {
width: auto;
height: 100%;
object-position: center center;
pointer-events: none;
border-radius: 0px;
}
}
.slide-image {
width: auto;
height: 100%;
object-position: center center;
pointer-events: none;
user-select: none; // Запрещаем выделение и для одиночных изображений
border-radius: 0px;
}
}
}
}
/* стрелки */
/* Кастомные стрелки */
.custom-navigation {
display: flex;
justify-content: space-between;
align-items: center;
position: absolute;
top: 50%;
width: 100%;
transform: translateY(-50%);
z-index: 10;
display: flex;
justify-content: space-between;
align-items: center;
position: absolute;
top: 50%;
transform: translateY(-50%);
background: rgba(0, 0, 0, 0.7);
color: white;
border: none;
width: 40px;
height: 40px;
border-radius: 50%;
cursor: pointer;
font-size: 18px;
display: flex;
align-items: center;
justify-content: center;
z-index: 2;
transition: all 0.2s ease;
&:hover {
background: rgba(0, 0, 0, 0.9);
transform: translateY(-50%) scale(1.1);
}
&[disabled] {
display: none;
}
}
.alice-carousel__wrapper {
width: 185%;
height: auto;
left: -240px;
user-select: none;
}
.alice-carousel__prev-btn {
left: 10px;
&::before {
content: "←";
}
}
.custom-prev,
.custom-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;
font-size: 24px;
border: none;
.alice-carousel__next-btn {
right: 10px;
&::before {
content: "→";
}
}
.custom-prev {
margin-left: -70px;
// Стили для Alice Carousel (добавить в конец файла)
.slider {
// Ваши существующие стили остаются без изменений
@media (max-width: 768px) {
margin-left: 0px;
// Стили для Alice Carousel
.alice-carousel {
&__wrapper {
position: relative;
}
}
.custom-next {
margin-right: -70px;
@media (max-width: 768px) {
margin-right: 0px;
&__stage {
padding: 0;
}
}
.slider.news {
.swiper-slide {
opacity: 0.5;
transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
height: 65vh;
&__stage-item {
padding: 0 10px;
}
.slide-image {
height: 500px;
// Используем ваши оригинальные стили для кнопок навигации
&__prev-btn,
&__next-btn {
position: absolute;
top: 50%;
transform: translateY(-50%);
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;
font-size: 24px;
border: none;
z-index: 10;
}
&__prev-btn {
left: -70px;
&::before {
content: "‹";
}
@media (max-width: 768px) {
left: 0px;
}
}
&__next-btn {
right: -70px;
&::before {
content: "›";
}
@media (max-width: 768px) {
right: 0px;
}
}
// Стили для точек навигации
&__dots {
display: flex;
justify-content: center;
gap: 8px;
margin-top: 15px;
&-item {
width: 10px;
height: 10px;
border-radius: 50%;
background: rgba(0, 0, 0, 0.3);
cursor: pointer;
transition: all 0.2s ease;
border: none;
&.__active {
background: #007bff;
transform: scale(1.2);
}
@media (max-width: 768px) {
opacity: 1;
transition: none;
height: 48vh;
.slide-image {
height: 350px;
}
&:hover {
background: rgba(0, 0, 0, 0.6);
}
}
}
.swiper-slide-active {
opacity: 1;
// Скрываем точки когда они отключены
&.__disabled-dots .alice-carousel__dots {
display: none;
}
&.no-animation .swiper-slide {
transition: none;
// Скрываем кнопки когда они отключены
&.__disabled-buttons {
.alice-carousel__prev-btn,
.alice-carousel__next-btn {
display: none;
}
}
}
}
.slider-item {
display: flex;
justify-content: center;
align-items: center;
}
.slide-image {
width: 100%;
height: 300px;
object-fit: cover;
border-radius: 4px;
@media (max-width: 768px) {
height: 250px;
}
}
// Responsive стили
@media (max-width: 768px) {
.slider {
.alice-carousel__stage-item {
padding: 0 5px;
}
.swiper-wrapper:has(.swiper-slide.single) {
justify-content: center !important;
.alice-carousel__prev-btn,
.alice-carousel__next-btn {
width: 35px;
height: 35px;
font-size: 16px;
}
.swiper-slide-prev,
.swiper-slide-next {
opacity: 0.7;
transform: scale(0.9);
@media (max-width: 768px) {
opacity: 1;
transform: none;
}
.alice-carousel__prev-btn {
left: 5px;
}
}
.alice-carousel__next-btn {
right: 5px;
}
}
}