Implement modern media gallery with enhanced features
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
- Fix CSS loading issue in project_detail.html template - Add comprehensive ModernMediaGallery JavaScript class with touch navigation - Implement glassmorphism design with backdrop-filter effects - Add responsive breakpoint system for mobile devices - Include embedded critical CSS styles for gallery functionality - Add technology sidebar with vertical list layout and hover effects - Support for images, videos, and embedded content with thumbnails - Add lightbox integration and media type badges - Implement progress bar and thumbnail navigation - Add keyboard controls (arrow keys) and touch swipe gestures - Include supplementary styles for video/embed placeholders - Fix template block naming compatibility (extra_css → extra_styles)
This commit is contained in:
589
smartsoltech/static/assets/css/compact-gallery.css
Normal file
589
smartsoltech/static/assets/css/compact-gallery.css
Normal file
@@ -0,0 +1,589 @@
|
||||
/* Современная медиа-галерея */
|
||||
.modern-media-gallery {
|
||||
background: white;
|
||||
border-radius: 24px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
|
||||
border: 1px solid #f1f5f9;
|
||||
margin-bottom: 3rem;
|
||||
}
|
||||
|
||||
/* Основное медиа */
|
||||
.main-media-container {
|
||||
position: relative;
|
||||
aspect-ratio: 16/10;
|
||||
overflow: hidden;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.main-media-wrapper {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.main-media-item {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
transition: opacity 0.5s ease;
|
||||
}
|
||||
|
||||
.main-media-item.active {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.main-media-img,
|
||||
.main-media-video {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.embed-container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.main-media-embed {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* Overlay с информацией */
|
||||
.media-overlay {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
|
||||
padding: 2rem;
|
||||
color: white;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: end;
|
||||
}
|
||||
|
||||
.main-media-item:hover .media-overlay {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.media-info {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.media-title {
|
||||
font-size: 1.1rem;
|
||||
font-weight: 600;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.media-meta {
|
||||
font-size: 0.9rem;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.media-action-btn {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
-webkit-backdrop-filter: blur(10px);
|
||||
backdrop-filter: blur(10px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||
border-radius: 50%;
|
||||
color: white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 1.2rem;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
margin-left: 1rem;
|
||||
}
|
||||
|
||||
.media-action-btn:hover {
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
/* Навигационные кнопки */
|
||||
.media-nav-btn {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
-webkit-backdrop-filter: blur(10px);
|
||||
backdrop-filter: blur(10px);
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
color: #4f46e5;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 1.1rem;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.main-media-wrapper:hover .media-nav-btn {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.prev-btn {
|
||||
left: 20px;
|
||||
}
|
||||
|
||||
.next-btn {
|
||||
right: 20px;
|
||||
}
|
||||
|
||||
.media-nav-btn:hover {
|
||||
background: white;
|
||||
transform: translateY(-50%) scale(1.1);
|
||||
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
/* Миниатюры */
|
||||
.thumbnails-container {
|
||||
padding: 1.5rem;
|
||||
background: #fafbfc;
|
||||
border-top: 1px solid #f1f5f9;
|
||||
}
|
||||
|
||||
.thumbnails-wrapper {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
overflow-x: auto;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
/* Для Firefox */
|
||||
.thumbnails-wrapper {
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: #cbd5e0 transparent;
|
||||
}
|
||||
|
||||
/* Для Webkit браузеров */
|
||||
.thumbnails-wrapper::-webkit-scrollbar {
|
||||
height: 6px;
|
||||
}
|
||||
|
||||
.thumbnails-wrapper::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.thumbnails-wrapper::-webkit-scrollbar-thumb {
|
||||
background: #cbd5e0;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.thumbnail-item {
|
||||
position: relative;
|
||||
width: 80px;
|
||||
height: 60px;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
flex-shrink: 0;
|
||||
border: 2px solid transparent;
|
||||
}
|
||||
|
||||
.thumbnail-item:hover {
|
||||
transform: scale(1.05);
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.thumbnail-item.active {
|
||||
border-color: #4f46e5;
|
||||
transform: scale(1.05);
|
||||
box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
|
||||
}
|
||||
|
||||
.thumbnail-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.video-thumbnail-placeholder,
|
||||
.embed-thumbnail-placeholder {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: white;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.media-type-badge {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
right: 4px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 0.7rem;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.media-type-badge.video {
|
||||
background: #ef4444;
|
||||
}
|
||||
|
||||
.media-type-badge.embed {
|
||||
background: #06b6d4;
|
||||
}
|
||||
|
||||
.thumbnail-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease;
|
||||
}
|
||||
|
||||
.thumbnail-item:hover .thumbnail-overlay {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.thumbnail-number {
|
||||
color: white;
|
||||
font-weight: 600;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
/* Индикатор прогресса */
|
||||
.gallery-progress {
|
||||
height: 4px;
|
||||
background: #f1f5f9;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, #4f46e5 0%, #7c3aed 100%);
|
||||
transition: width 0.4s ease;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
/* Placeholder для проектов без изображений */
|
||||
.project-placeholder-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #64748b;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.project-placeholder-image i {
|
||||
font-size: 4rem;
|
||||
margin-bottom: 1rem;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.project-placeholder-image p {
|
||||
font-size: 1.1rem;
|
||||
font-weight: 500;
|
||||
margin: 0;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
/* Адаптивность */
|
||||
@media (max-width: 1024px) {
|
||||
.main-media-container {
|
||||
aspect-ratio: 16/9;
|
||||
}
|
||||
|
||||
.media-overlay {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.thumbnails-container {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.thumbnail-item {
|
||||
width: 70px;
|
||||
height: 52px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.modern-media-gallery {
|
||||
border-radius: 16px;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.media-overlay {
|
||||
padding: 1rem;
|
||||
background: rgba(0, 0, 0, 0.7);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.media-nav-btn {
|
||||
opacity: 1;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.prev-btn {
|
||||
left: 12px;
|
||||
}
|
||||
|
||||
.next-btn {
|
||||
right: 12px;
|
||||
}
|
||||
|
||||
.thumbnails-container {
|
||||
padding: 0.75rem;
|
||||
}
|
||||
|
||||
.thumbnail-item {
|
||||
width: 60px;
|
||||
height: 45px;
|
||||
}
|
||||
|
||||
.media-action-btn {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* HTML-контент в описании проекта */
|
||||
.description-text h1,
|
||||
.description-text h2,
|
||||
.description-text h3,
|
||||
.description-text h4,
|
||||
.description-text h5,
|
||||
.description-text h6 {
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 1rem;
|
||||
font-weight: 600;
|
||||
color: #1a202c;
|
||||
}
|
||||
|
||||
.description-text h1 { font-size: 2rem; }
|
||||
.description-text h2 { font-size: 1.75rem; }
|
||||
.description-text h3 { font-size: 1.5rem; }
|
||||
.description-text h4 { font-size: 1.25rem; }
|
||||
.description-text h5 { font-size: 1.1rem; }
|
||||
.description-text h6 { font-size: 1rem; }
|
||||
|
||||
.description-text p {
|
||||
margin-bottom: 1.2rem;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.description-text ul,
|
||||
.description-text ol {
|
||||
margin: 1.5rem 0;
|
||||
padding-left: 2rem;
|
||||
}
|
||||
|
||||
.description-text li {
|
||||
margin-bottom: 0.5rem;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.description-text blockquote {
|
||||
border-left: 4px solid #4f46e5;
|
||||
padding-left: 1.5rem;
|
||||
margin: 2rem 0;
|
||||
font-style: italic;
|
||||
background: #f8fafc;
|
||||
padding: 1.5rem;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.description-text code {
|
||||
background: #f1f5f9;
|
||||
padding: 0.2rem 0.4rem;
|
||||
border-radius: 4px;
|
||||
font-family: 'Monaco', 'Menlo', monospace;
|
||||
font-size: 0.9em;
|
||||
color: #e53e3e;
|
||||
}
|
||||
|
||||
.description-text pre {
|
||||
background: #1a202c;
|
||||
color: #fff;
|
||||
padding: 1.5rem;
|
||||
border-radius: 8px;
|
||||
overflow-x: auto;
|
||||
margin: 1.5rem 0;
|
||||
}
|
||||
|
||||
.description-text pre code {
|
||||
background: none;
|
||||
color: inherit;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.description-text a {
|
||||
color: #4f46e5;
|
||||
text-decoration: none;
|
||||
border-bottom: 1px solid transparent;
|
||||
transition: border-color 0.3s ease;
|
||||
}
|
||||
|
||||
.description-text a:hover {
|
||||
border-bottom-color: #4f46e5;
|
||||
}
|
||||
|
||||
.description-text strong,
|
||||
.description-text b {
|
||||
font-weight: 600;
|
||||
color: #1a202c;
|
||||
}
|
||||
|
||||
.description-text em,
|
||||
.description-text i {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.description-text img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
border-radius: 8px;
|
||||
margin: 1.5rem 0;
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.description-text hr {
|
||||
border: none;
|
||||
height: 2px;
|
||||
background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
|
||||
margin: 3rem 0;
|
||||
border-radius: 1px;
|
||||
}
|
||||
|
||||
.description-text table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin: 2rem 0;
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.description-text th,
|
||||
.description-text td {
|
||||
padding: 1rem;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.description-text th {
|
||||
background: #f8fafc;
|
||||
font-weight: 600;
|
||||
color: #1a202c;
|
||||
}
|
||||
|
||||
/* HTML-контент в технологиях */
|
||||
.technologies-html-content {
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.technologies-html-content p {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.technologies-html-content code {
|
||||
background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
|
||||
color: white;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 8px;
|
||||
font-family: 'Monaco', 'Menlo', monospace;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
display: inline-block;
|
||||
margin: 0.25rem 0;
|
||||
box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.technologies-html-content code:hover {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
|
||||
}
|
||||
|
||||
.technologies-html-content p code {
|
||||
margin: 0.2rem;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.technologies-html-content h1,
|
||||
.technologies-html-content h2,
|
||||
.technologies-html-content h3,
|
||||
.technologies-html-content h4,
|
||||
.technologies-html-content h5,
|
||||
.technologies-html-content h6 {
|
||||
margin-top: 1.5rem;
|
||||
margin-bottom: 0.75rem;
|
||||
font-weight: 600;
|
||||
color: #1a202c;
|
||||
}
|
||||
|
||||
.technologies-html-content ul,
|
||||
.technologies-html-content ol {
|
||||
margin: 1rem 0;
|
||||
padding-left: 1.5rem;
|
||||
}
|
||||
|
||||
.technologies-html-content li {
|
||||
margin-bottom: 0.4rem;
|
||||
}
|
||||
|
||||
.technologies-html-content strong,
|
||||
.technologies-html-content b {
|
||||
font-weight: 600;
|
||||
color: #1a202c;
|
||||
}
|
||||
|
||||
.technologies-html-content em,
|
||||
.technologies-html-content i {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.technologies-html-content a {
|
||||
color: #4f46e5;
|
||||
text-decoration: none;
|
||||
border-bottom: 1px solid transparent;
|
||||
transition: border-color 0.3s ease;
|
||||
}
|
||||
|
||||
.technologies-html-content a:hover {
|
||||
border-bottom-color: #4f46e5;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
227
smartsoltech/static/assets/js/project-detail.js
Normal file
227
smartsoltech/static/assets/js/project-detail.js
Normal file
@@ -0,0 +1,227 @@
|
||||
// Modern Project Detail Page Enhancements
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
// Animate counter numbers
|
||||
function animateCounters() {
|
||||
const counters = document.querySelectorAll('.stat-number[data-target]');
|
||||
|
||||
const observer = new IntersectionObserver((entries) => {
|
||||
entries.forEach(entry => {
|
||||
if (entry.isIntersecting) {
|
||||
const counter = entry.target;
|
||||
const target = parseInt(counter.dataset.target);
|
||||
const duration = 2000; // 2 seconds
|
||||
const step = target / (duration / 16); // 60fps
|
||||
let current = 0;
|
||||
|
||||
const timer = setInterval(() => {
|
||||
current += step;
|
||||
counter.textContent = Math.floor(current);
|
||||
|
||||
if (current >= target) {
|
||||
counter.textContent = target;
|
||||
clearInterval(timer);
|
||||
}
|
||||
}, 16);
|
||||
|
||||
observer.unobserve(counter);
|
||||
}
|
||||
});
|
||||
}, {
|
||||
threshold: 0.5
|
||||
});
|
||||
|
||||
counters.forEach(counter => observer.observe(counter));
|
||||
}
|
||||
|
||||
// Scroll-triggered animations
|
||||
function initScrollAnimations() {
|
||||
const animatedElements = document.querySelectorAll('.content-section, .tech-item, .info-item');
|
||||
|
||||
const observer = new IntersectionObserver((entries) => {
|
||||
entries.forEach((entry, index) => {
|
||||
if (entry.isIntersecting) {
|
||||
setTimeout(() => {
|
||||
entry.target.style.opacity = '1';
|
||||
entry.target.style.transform = 'translateY(0)';
|
||||
}, index * 100);
|
||||
}
|
||||
});
|
||||
}, {
|
||||
threshold: 0.1,
|
||||
rootMargin: '0px 0px -50px 0px'
|
||||
});
|
||||
|
||||
animatedElements.forEach(el => {
|
||||
el.style.opacity = '0';
|
||||
el.style.transform = 'translateY(30px)';
|
||||
el.style.transition = 'opacity 0.6s ease, transform 0.6s ease';
|
||||
observer.observe(el);
|
||||
});
|
||||
}
|
||||
|
||||
// Share functionality
|
||||
function initShareButton() {
|
||||
const shareBtn = document.querySelector('.share-btn');
|
||||
if (shareBtn) {
|
||||
shareBtn.addEventListener('click', async function() {
|
||||
const projectTitle = document.querySelector('.hero-title').textContent;
|
||||
const url = window.location.href;
|
||||
|
||||
if (navigator.share) {
|
||||
try {
|
||||
await navigator.share({
|
||||
title: projectTitle,
|
||||
text: `Посмотрите на этот проект: ${projectTitle}`,
|
||||
url: url
|
||||
});
|
||||
} catch (err) {
|
||||
console.log('Sharing failed:', err);
|
||||
fallbackShare(url);
|
||||
}
|
||||
} else {
|
||||
fallbackShare(url);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function fallbackShare(url) {
|
||||
// Copy to clipboard as fallback
|
||||
if (navigator.clipboard) {
|
||||
navigator.clipboard.writeText(url).then(() => {
|
||||
showToast('Ссылка скопирована в буфер обмена!');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function showToast(message) {
|
||||
// Create toast notification
|
||||
const toast = document.createElement('div');
|
||||
toast.className = 'toast-notification';
|
||||
toast.textContent = message;
|
||||
toast.style.cssText = `
|
||||
position: fixed;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
background: linear-gradient(135deg, #48bb78, #38a169);
|
||||
color: white;
|
||||
padding: 1rem 1.5rem;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
|
||||
z-index: 10000;
|
||||
transform: translateX(400px);
|
||||
transition: transform 0.3s ease;
|
||||
`;
|
||||
|
||||
document.body.appendChild(toast);
|
||||
|
||||
setTimeout(() => {
|
||||
toast.style.transform = 'translateX(0)';
|
||||
}, 100);
|
||||
|
||||
setTimeout(() => {
|
||||
toast.style.transform = 'translateX(400px)';
|
||||
setTimeout(() => document.body.removeChild(toast), 300);
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
// Tech item hover effects
|
||||
function initTechInteractions() {
|
||||
const techItems = document.querySelectorAll('.tech-item');
|
||||
|
||||
techItems.forEach(item => {
|
||||
item.addEventListener('mouseenter', function() {
|
||||
this.style.transform = 'translateY(-8px) scale(1.02)';
|
||||
});
|
||||
|
||||
item.addEventListener('mouseleave', function() {
|
||||
this.style.transform = 'translateY(-5px) scale(1)';
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Parallax effect for hero background
|
||||
function initParallaxEffect() {
|
||||
const heroBackground = document.querySelector('.hero-pattern');
|
||||
if (!heroBackground) return;
|
||||
|
||||
let ticking = false;
|
||||
|
||||
function updateParallax() {
|
||||
const scrolled = window.pageYOffset;
|
||||
const rate = scrolled * -0.3;
|
||||
|
||||
heroBackground.style.transform = `translateY(${rate}px)`;
|
||||
ticking = false;
|
||||
}
|
||||
|
||||
function requestTick() {
|
||||
if (!ticking) {
|
||||
requestAnimationFrame(updateParallax);
|
||||
ticking = true;
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('scroll', requestTick);
|
||||
}
|
||||
|
||||
// Smooth scroll for internal links
|
||||
function initSmoothScroll() {
|
||||
const links = document.querySelectorAll('a[href^="#"]');
|
||||
|
||||
links.forEach(link => {
|
||||
link.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
const targetId = this.getAttribute('href');
|
||||
const targetSection = document.querySelector(targetId);
|
||||
|
||||
if (targetSection) {
|
||||
targetSection.scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'start'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Initialize all enhancements
|
||||
animateCounters();
|
||||
initScrollAnimations();
|
||||
initShareButton();
|
||||
initTechInteractions();
|
||||
initParallaxEffect();
|
||||
initSmoothScroll();
|
||||
|
||||
// Add loading class removal after page load
|
||||
window.addEventListener('load', function() {
|
||||
document.body.classList.add('page-loaded');
|
||||
});
|
||||
});
|
||||
|
||||
// CSS for page loading animation
|
||||
const loadingStyles = `
|
||||
body:not(.page-loaded) .project-hero {
|
||||
opacity: 0;
|
||||
transform: translateY(50px);
|
||||
transition: opacity 0.8s ease, transform 0.8s ease;
|
||||
}
|
||||
|
||||
body.page-loaded .project-hero {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.toast-notification {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
`;
|
||||
|
||||
// Inject loading styles
|
||||
const styleSheet = document.createElement('style');
|
||||
styleSheet.textContent = loadingStyles;
|
||||
document.head.appendChild(styleSheet);
|
||||
Reference in New Issue
Block a user