Offshore Wind Consultant & Logistics
Route Surveys & Feasibility Studies: Conducting detailed route analysis and feasibility assessments for complex logistics projects.
Risk Management & HSE Compliance: Ensuring safety and regulatory compliance throughout the logistics process.
Emergency Logistics Services: Rapid response solutions for urgent shipments and time-sensitive cargo handling.
document.addEventListener("DOMContentLoaded", function () { const sections = document.querySelectorAll("#section-0, #section-1, #section-2"); let sectionPositions = []; // Cập nhật vị trí từng section (nếu chiều cao section thay đổi) function updateSectionPositions() { sectionPositions = Array.from(sections).map((section) => { const sectionHeight = section.offsetHeight; // Lấy chiều cao thực tế của section const isSection0 = section.id === "section-0"; // Kiểm tra riêng section-0 const isSpecialSection = ["section-2"].includes(section.id); const isRegularSection = ["section-1"].includes(section.id); let offsetAdjustment = 0; // Giá trị mặc định if (isSection0) { // Không căn giữa, giữ vị trí mặc định return section.offsetTop; } else if (isSpecialSection) { offsetAdjustment = -60; // Điều chỉnh offset cho các section đặc biệt } else if (isRegularSection) { offsetAdjustment = -30; // Điều chỉnh offset cho các section thông thường } // Tính toán vị trí offset căn giữa const offset = section.offsetTop - (window.innerHeight - sectionHeight) / 2 + offsetAdjustment; return offset; }); } // Gọi hàm cập nhật khi DOMContentLoaded updateSectionPositions(); let isScrolling = false; // Trạng thái đang cuộn const scrollDuration = 500; // Thời gian cuộn (ms) // Hàm cuộn đến vị trí mục tiêu function scrollToSection(targetIndex) { if (targetIndex < 0 || targetIndex >= sectionPositions.length) return; // Kiểm tra giới hạn index window.scrollTo({ top: sectionPositions[targetIndex], behavior: "smooth", }); // Đợi cuộn hoàn tất trước khi cho phép cuộn tiếp setTimeout(() => { isScrolling = false; }, scrollDuration); } // Lắng nghe sự kiện cuộn chuột window.addEventListener("wheel", function (event) { if (isScrolling) return; // Nếu đang cuộn, bỏ qua sự kiện mới isScrolling = true; const currentScroll = window.scrollY + window.innerHeight / 2; // Tính vị trí hiện tại dựa vào trung tâm màn hình const direction = event.deltaY > 0 ? 1 : -1; // Kiểm tra hướng cuộn (xuống hoặc lên) // Tìm section hiện tại let currentIndex = sectionPositions.findIndex((pos, i) => { const nextPos = sectionPositions[i + 1] || Infinity; return currentScroll >= pos && currentScroll < nextPos; }); if (currentIndex === -1) currentIndex = 0; // Phòng trường hợp không tìm thấy index // Tính index mục tiêu let targetIndex; if (direction === 1) { // Cuộn xuống: Tìm section tiếp theo targetIndex = currentIndex + 1 < sectionPositions.length ? currentIndex + 1 : currentIndex; } else if (direction === -1) { // Cuộn lên: Tìm section trước đó targetIndex = currentIndex - 1 >= 0 ? currentIndex - 1 : currentIndex; } // Cuộn đến section mục tiêu scrollToSection(targetIndex); }); // Cập nhật lại vị trí section khi thay đổi kích thước cửa sổ window.addEventListener("resize", updateSectionPositions); // Khi load trang, cuộn đến section gần nhất const currentScroll = window.scrollY + window.innerHeight / 2; const closestIndex = sectionPositions.findIndex((pos, i) => { const nextPos = sectionPositions[i + 1] || Infinity; return currentScroll >= pos && currentScroll < nextPos; }); if (closestIndex !== -1) { scrollToSection(closestIndex); } });