This commit is contained in:
zakhy 2024-12-23 12:02:34 +07:00
parent a4180446f9
commit 710bb6cbcc
5 changed files with 106 additions and 56 deletions

View File

@ -95,7 +95,7 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
# AUTH_USER_MODEL = 'users.User'
LOGIN_URL = '/users/login'
APP_VERSION = '1.0.0.8'
APP_VERSION = '1.0.1.0'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
CSRF_TRUSTED_ORIGINS = ["https://cybercode.pro", "http://cybercode.pro"]

View File

@ -55,7 +55,6 @@ if (targetSlide !== null && !isNaN(targetSlide)) {
}
function truncateText(text, wordLimit) {
const words = text.split(' ');
if (words.length > wordLimit) {
@ -121,63 +120,58 @@ function truncateText(text, wordLimit) {
projectSlides.appendChild(projectSlide)
}
// вложенный свайпер
const innerSwiper = document.querySelector('.innerSwiper')
if (innerSwiper) {
var innerSwiperObj = new Swiper(innerSwiper, {
effect: "coverflow",
grabCursor: true,
centeredSlides: true,
slidesPerView: "auto",
loop: true,
spaceBetween: 70,
coverflowEffect: {
rotate: 0,
stretch: 0,
depth: 100,
modifier: 1,
slideShadows: true,
},
pagination: {
el: ".swiper-pagination",
clickable: true,
},
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
});
}
const innerSwiper = document.querySelector('.innerSwiper')
if (innerSwiper) {
var innerSwiperObj = new Swiper(innerSwiper, {
effect: "coverflow",
grabCursor: true,
centeredSlides: true,
slidesPerView: "auto",
loop: true,
spaceBetween: 70,
coverflowEffect: {
rotate: 0,
stretch: 0,
depth: 100,
modifier: 1,
slideShadows: true,
},
pagination: {
el: ".swiper-pagination",
clickable: true,
},
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
});
}
})();
// Услуги
(async () => {
function createServiceItem(service) {
const colDiv = document.createElement('div');
colDiv.classList.add('col-lg-4', 'col-md-6', 'col-sm-12');
// Создание элемента a с классами 'color-white' и 'text-decoration-none'
// Создаем элемент <a>
const link = document.createElement('a');
link.href = `services/${service.slug}/`;
link.classList.add('color-white', 'text-decoration-none');
link.classList.add(
'service-slide',
'color-white',
'rounded',
'd-flex',
'justify-content-center',
'align-items-center',
'text-decoration-none',
);
// Создание div для блока услуги с классами и стилями
const serviceDiv = document.createElement('div');
serviceDiv.classList.add('p-3', 'rounded', 'd-flex', 'justify-content-center', 'align-items-center', 'service-item');
serviceDiv.style.backgroundColor = 'rgba(0, 0, 0, 0.3)';
// Создание заголовка h4 с текстом
// Создаем элемент <h4> для текста
const serviceTitle = document.createElement('h4');
serviceTitle.textContent = service.name;
// Вложение заголовка в блок услуги
serviceDiv.appendChild(serviceTitle);
// Вкладываем заголовок внутрь ссылки
link.appendChild(serviceTitle);
// Вложение блока услуги в ссылку
link.appendChild(serviceDiv);
// Вложение ссылки в основной контейнер
colDiv.appendChild(link);
return colDiv;
// Возвращаем готовый элемент
return link;
}
const response = await fetch('services/')
@ -188,4 +182,38 @@ if (innerSwiper) {
let serviceItem = createServiceItem(service)
servicesWrapper.appendChild(serviceItem)
}
})();
})();
new Swiper('#indexSliderService', {
slidesPerView: 1,
slideClass: 'service-slide',
grid: {
rows: 4, // По умолчанию одна строка
fill: 'row', // Заполняем ряды
},
spaceBetween: 20, // Расстояние между элементами
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
breakpoints: {
576: { // Экран от 576px
slidesPerView: 2,
grid: {
rows: 4,
},
},
768: { // Экран от 768px
slidesPerView: 3,
grid: {
rows: 2,
},
},
1200: { // Экран от 1200px
slidesPerView: 3,
grid: {
rows: 4,
},
},
},
});

View File

@ -472,4 +472,23 @@ article p a {
background-color: #f9f9fd;
}
}
.service-slide {
background-color: rgba(0, 0, 0, 0.3);
text-align: center;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
min-height: 125px;
padding: 30px;
}
a.service-slide {
height: 100%;
}
@media (max-width: 500px) {
.service-slide
}

View File

@ -10,7 +10,7 @@
.slider .swiper-slide {
background: none;
overflow: hidden;
overflow: hidden !important;
position: relative;
height: 100%;
text-align: start;

View File

@ -54,13 +54,15 @@
<div style="backdrop-filter:brightness(40%);" class="h-100 w-100 m-0 p-0">
<div class="slide-text color-white d-flex flex-column align-items-center pt-base h-100">
<h2 class="color-white text-align-center display-3">Наши услуги</h2>
{# <ul class="list-style-none p-2" id="servicesWrapper">#}
{# </ul>#}
<div class="container">
<div class="row gy-3 gx-3" id="servicesWrapper">
{# <div class="container">#}
<div id="indexSliderService" class="p-3" style="width: 100%;">
<div class="swiper-wrapper" id="servicesWrapper">
</div>
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
</div>
{# </div>#}
</div>
</div>
</div>
@ -93,7 +95,8 @@
</div>
<div class="d-flex gap-1">
<i class="fa fa-phone" style="margin-top: 5px;"></i>
<a href="tel:{{ contacts.phone_number.content|safe }}" class="color-black">{{ contacts.phone_number.content|safe }}</a>
<a href="tel:{{ contacts.phone_number.content|safe }}"
class="color-black">{{ contacts.phone_number.content|safe }}</a>
</div>
<div class="d-flex gap-1">
<i class="fa fa-envelope" style="margin-top: 5px;"></i>