From ab2f48bcd434edbaa4d2a1cc7785aef8d5b7671d Mon Sep 17 00:00:00 2001 From: zakhy <=> Date: Fri, 29 Nov 2024 11:08:33 +0700 Subject: [PATCH] fix from feedback --- app/static/cybercode/js/script.js | 105 ++++------- app/static/cybercode/styles/style-lib.css | 13 ++ app/static/cybercode/styles/style.css | 4 +- app/templates/base.html | 207 +++++++++++++--------- app/templates/index.html | 8 +- app/templates/project.html | 18 +- app/templates/service.html | 2 +- app/website/models/project.py | 1 + app/website/models/service.py | 1 + app/website/views.py | 3 + 10 files changed, 198 insertions(+), 164 deletions(-) diff --git a/app/static/cybercode/js/script.js b/app/static/cybercode/js/script.js index dcebd24..47e019d 100644 --- a/app/static/cybercode/js/script.js +++ b/app/static/cybercode/js/script.js @@ -1,6 +1,7 @@ -const interleaveOffset = 0.01; +const swiperContainer = document.querySelector('.swiper-container') -var swiper = new Swiper('.swiper-container', { +const interleaveOffset = 0.01; +var swiper = new Swiper(swiperContainer, { direction: 'vertical', speed: 500, watchSlidesProgress: true, @@ -46,76 +47,40 @@ var swiper = new Swiper('.swiper-container', { } }, }); - -// Добавим обновление состояния слайдов на случай неправильной анимации при изменении слайда -swiper.on('slideChange', function () { - const currentIndex = swiper.activeIndex; - const headerWrapper = document.querySelector('.header'); - - if (currentIndex === 2) { - headerWrapper.classList.remove('color-white'); - headerWrapper.classList.add('color-black'); - } else { - headerWrapper.classList.remove('color-black'); - headerWrapper.classList.add('color-white'); - } - - // Обновим прогресс и классы слайдов после изменения - swiper.updateSlidesProgress(); - swiper.updateSlidesClasses(); -}); - -const projectLink = document.querySelector('#projects') -const aboutLink = document.querySelector('#about') -const contactsLink = document.querySelector('#contacts') -const servicesLink = document.querySelector('#services') -const mainLink = document.querySelector('#mainLink') -const projectBtn = document.querySelector('#projectBtn') -mainLink.addEventListener('click', () => { - swiper.slideTo(0, 800) -}) -projectLink.addEventListener('click', () => { - swiper.slideTo(1, 800) -}) -projectBtn.addEventListener('click', () => { - swiper.slideTo(1, 800) -}) -servicesLink.addEventListener('click', () => { - swiper.slideTo(2, 800) -}) -aboutLink.addEventListener('click', () => { - swiper.slideTo(3, 800) -}) - -contactsLink.addEventListener('click', () => { - swiper.slideTo(4, 800) -}) +// Проверка localStorage для перехода к слайду +const targetSlide = localStorage.getItem('targetSlide'); +if (targetSlide !== null && !isNaN(targetSlide)) { + window.swiper.slideTo(parseInt(targetSlide), 800); + localStorage.removeItem('targetSlide'); +} // вложенный свайпер - -var mySwiper = new Swiper(".mySwiper", { - 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", + }, + }); +} function truncateText(text, wordLimit) { const words = text.split(' '); diff --git a/app/static/cybercode/styles/style-lib.css b/app/static/cybercode/styles/style-lib.css index 100ebd3..2a3c8e0 100755 --- a/app/static/cybercode/styles/style-lib.css +++ b/app/static/cybercode/styles/style-lib.css @@ -90,9 +90,15 @@ .w-100 { width: 100%; } + +.min-h-100vh { + min-height: 100vh +} + .w-80 { width: 80%; } + .h-100vh { height: 100vh; } @@ -108,9 +114,11 @@ .w-800px { width: 800px; } + .w-1200px { width: 1200px; } + .pos-absolute { position: absolute; } @@ -171,6 +179,11 @@ .radius-5 { border-radius: 5px; } + .cursor-pointer { cursor: pointer; +} + +.border-none { + border: none } \ No newline at end of file diff --git a/app/static/cybercode/styles/style.css b/app/static/cybercode/styles/style.css index 3df1424..00dd81a 100644 --- a/app/static/cybercode/styles/style.css +++ b/app/static/cybercode/styles/style.css @@ -8,9 +8,7 @@ box-sizing: border-box; } -body { - overflow: hidden; -} + body { margin: 0; diff --git a/app/templates/base.html b/app/templates/base.html index 47d3f40..b46f7af 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -25,50 +25,60 @@ {% block title %}