Hidroizolatie terasa garaj Otopeni, ILFOV

Hidroizolatie terasa garaj Otopeni, ILFOV
// Funcționalitate pentru navigarea sticky jQuery(document).ready(function($) { const projectNav = document.getElementById('project-nav-sticky'); if (!projectNav) return; const navItems = projectNav.querySelectorAll('.nav-item'); const sections = document.querySelectorAll('.project-section, [id^="section-"]'); const navHeight = projectNav.offsetHeight; // Creează un placeholder pentru a preveni saltul conținutului când meniul devine sticky const navPlaceholder = document.createElement('div'); navPlaceholder.id = 'project-nav-placeholder'; navPlaceholder.style.height = navHeight + 'px'; navPlaceholder.style.display = 'none'; projectNav.parentNode.insertBefore(navPlaceholder, projectNav); // Funcție pentru a face meniul sticky function handleScroll() { const scrollPosition = window.scrollY; const navTop = projectNav.offsetTop; if (scrollPosition > navTop) { if (!projectNav.classList.contains('sticky')) { projectNav.classList.add('sticky'); navPlaceholder.style.display = 'block'; } } else { projectNav.classList.remove('sticky'); navPlaceholder.style.display = 'none'; } // Actualizează link-ul activ dacă avem secțiuni if (sections.length > 0) { updateActiveNavLink(); } } // Funcție pentru a actualiza link-ul activ în funcție de secțiunea vizibilă function updateActiveNavLink() { // Calculează offset-ul pentru verificarea secțiunilor vizibile let offset = navHeight; if (projectNav.classList.contains('sticky')) { // Adaugă offset suplimentar pentru meniul principal pe desktop offset += 76; } // Găsește secțiunea curentă vizibilă let currentSectionId = null; sections.forEach(section => { const sectionTop = section.offsetTop - offset - 20; // 20px tolerance const sectionBottom = sectionTop + section.offsetHeight; const scrollPosition = window.scrollY; if (scrollPosition >= sectionTop && scrollPosition < sectionBottom) { currentSectionId = section.getAttribute('id'); } }); // Actualizează clasa active pentru link-ul corespunzător navItems.forEach(item => { const href = item.getAttribute('href').substring(1); // Remove # if (href === currentSectionId) { item.classList.add('active'); } else { item.classList.remove('active'); } }); } // Adaugă event listener pentru scroll window.addEventListener('scroll', handleScroll); // Verifică poziția inițială handleScroll(); // Smooth scroll pentru link-urile de navigare navItems.forEach(item => { item.addEventListener('click', function(e) { e.preventDefault(); const targetId = this.getAttribute('href').substring(1); const targetSection = document.getElementById(targetId); if (targetSection) { // Calculează offset-ul pentru scroll let scrollOffset = navHeight; if (projectNav.classList.contains('sticky')) { // Adaugă offset suplimentar pentru meniul principal pe desktop scrollOffset += 76; } const targetPosition = targetSection.offsetTop - scrollOffset; window.scrollTo({ top: targetPosition, behavior: 'smooth' }); } }); }); });