Compare commits

...

2 Commits

View File

@@ -699,34 +699,42 @@
background: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px); backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2); border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 50px; border-radius: 24px;
padding: 8px; padding: 8px;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3); box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1); transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
min-width: 60px; min-width: 80px;
height: 48px;
display: flex; display: flex;
align-items: center;
justify-content: center; justify-content: center;
transform-origin: center;
}
.outer-pill.expanding {
transform: scale(1.02);
} }
.pill-indicators { .pill-indicators {
display: flex; display: flex;
gap: 4px; gap: 0;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background: transparent; background: transparent;
border-radius: 40px; border-radius: 20px;
padding: 4px; padding: 0;
transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1); transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
height: 32px;
} }
.pill-indicator { .pill-indicator {
background: rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.4);
border: none; border: none;
border-radius: 50%; border-radius: 50%;
width: 12px; width: 32px;
height: 12px; height: 32px;
padding: 0; padding: 0;
margin: 0; margin: 0 2px;
color: transparent; color: transparent;
font-size: 0; font-size: 0;
cursor: pointer; cursor: pointer;
@@ -738,13 +746,14 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.3); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.3);
flex-shrink: 0;
} }
.pill-indicator::before { .pill-indicator::before {
content: ''; content: '';
position: absolute; position: absolute;
width: 6px; width: 8px;
height: 6px; height: 8px;
background: white; background: white;
border-radius: 50%; border-radius: 50%;
opacity: 0.8; opacity: 0.8;
@@ -756,12 +765,14 @@
color: #333; color: #333;
font-size: 11px; font-size: 11px;
font-weight: 600; font-weight: 600;
padding: 8px 16px; padding: 0 16px;
border-radius: 25px; border-radius: 16px;
width: auto; width: auto;
height: auto; height: 32px;
min-width: 80px;
box-shadow: 0 5px 15px rgba(255, 255, 255, 0.3); box-shadow: 0 5px 15px rgba(255, 255, 255, 0.3);
backdrop-filter: blur(10px); backdrop-filter: blur(10px);
margin: 0 4px;
} }
.pill-indicator.active::before { .pill-indicator.active::before {
@@ -772,13 +783,13 @@
.pill-indicator:not(.active):hover { .pill-indicator:not(.active):hover {
background: rgba(255, 255, 255, 0.6); background: rgba(255, 255, 255, 0.6);
transform: scale(1.2); transform: scale(1.1);
box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6);
} }
.pill-indicator:not(.active):hover::before { .pill-indicator:not(.active):hover::before {
opacity: 1; opacity: 1;
transform: scale(1.2); transform: scale(1.1);
} }
.pill-indicator-title { .pill-indicator-title {
@@ -921,19 +932,38 @@ document.addEventListener('DOMContentLoaded', function() {
}); });
// Анимация внешней pill (растягивается под активный элемент) // Анимация внешней pill (растягивается под активный элемент)
setTimeout(() => {
if (outerPill) { if (outerPill) {
const activeIndicator = indicators[index]; const activeIndicator = indicators[index];
if (activeIndicator) { const inactiveCount = indicators.length - 1;
// Измеряем ширину активного элемента
const activeRect = activeIndicator.getBoundingClientRect();
const containerRect = outerPill.getBoundingClientRect();
// Вычисляем нужную ширину (с учетом padding) if (activeIndicator) {
const newWidth = Math.max(activeRect.width + 40, 120); // Даем время для применения стилей активного элемента
outerPill.style.width = newWidth + 'px'; setTimeout(() => {
// Вычисляем ширину на основе текста активного элемента
const titleElement = activeIndicator.querySelector('.pill-indicator-title');
let activePillWidth = 80; // минимальная ширина активного элемента
if (titleElement && titleElement.textContent) {
// Формула: длина текста * 7px + padding (32px) + min-width
const textLength = titleElement.textContent.length;
activePillWidth = Math.max(textLength * 7 + 32, 80);
}
// Ширина неактивных элементов: 32px каждый + margin 4px между ними
const inactiveWidth = inactiveCount * 32 + (inactiveCount - 1) * 4;
// Общая ширина: активный + неактивные + отступы + margin между активным и неактивными
const totalWidth = activePillWidth + inactiveWidth + 32 + (inactiveCount > 0 ? 8 : 0);
console.log('Calculated widths - Active:', activePillWidth, 'Inactive total:', inactiveWidth, 'Total:', totalWidth);
outerPill.style.width = totalWidth + 'px';
outerPill.style.transition = 'all 0.4s cubic-bezier(0.23, 1, 0.32, 1)'; outerPill.style.transition = 'all 0.4s cubic-bezier(0.23, 1, 0.32, 1)';
}, 50);
} }
} }
}, 10);
currentActiveIndex = index; currentActiveIndex = index;
} }
@@ -941,14 +971,24 @@ document.addEventListener('DOMContentLoaded', function() {
// Обработчики событий для индикаторов // Обработчики событий для индикаторов
indicators.forEach((indicator, index) => { indicators.forEach((indicator, index) => {
indicator.addEventListener('click', function() { indicator.addEventListener('click', function() {
console.log('Clicked indicator:', index);
currentActiveIndex = index; currentActiveIndex = index;
// Добавляем класс расширения
if (outerPill) {
outerPill.classList.add('expanding');
setTimeout(() => {
outerPill.classList.remove('expanding');
}, 400);
}
updatePillState(index); updatePillState(index);
}); });
// Hover эффекты для неактивных элементов // Hover эффекты для неактивных элементов
indicator.addEventListener('mouseenter', function() { indicator.addEventListener('mouseenter', function() {
if (!this.classList.contains('active')) { if (!this.classList.contains('active')) {
this.style.transform = 'scale(1.2)'; this.style.transform = 'scale(1.1)';
this.style.background = 'rgba(255, 255, 255, 0.6)'; this.style.background = 'rgba(255, 255, 255, 0.6)';
} }
}); });
@@ -965,14 +1005,41 @@ document.addEventListener('DOMContentLoaded', function() {
if (carousel) { if (carousel) {
carousel.addEventListener('slide.bs.carousel', function(event) { carousel.addEventListener('slide.bs.carousel', function(event) {
const nextIndex = event.to; const nextIndex = event.to;
console.log('Carousel sliding to:', nextIndex);
currentActiveIndex = nextIndex; currentActiveIndex = nextIndex;
// Добавляем класс расширения при смене слайда
if (outerPill) {
outerPill.classList.add('expanding');
setTimeout(() => {
outerPill.classList.remove('expanding');
}, 400);
}
updatePillState(nextIndex); updatePillState(nextIndex);
}); });
// Инициализируем первое состояние // Инициализируем первое состояние
setTimeout(() => { setTimeout(() => {
console.log('Initializing pill state...');
updatePillState(0); updatePillState(0);
}, 100); }, 200);
}
// Отслеживаем изменения размеров активного элемента
if (window.ResizeObserver) {
const resizeObserver = new ResizeObserver(entries => {
if (outerPill) {
const activeIndicator = indicators[currentActiveIndex];
if (activeIndicator && activeIndicator.classList.contains('active')) {
updatePillState(currentActiveIndex);
}
}
});
indicators.forEach(indicator => {
resizeObserver.observe(indicator);
});
} }
// Animate elements on scroll // Animate elements on scroll