Key Projects & Partners

Transportation and Installation of DAK NONG 300MW Wind Turbines and Blades

Client
Sungrow Power Vietnam
Category
Transport and Install
Year
2021

PVC-MS Collaboration with EXPC - Advancing Offshore Wind in Taiwan

Client
PVC - MS (PETROLEUM EQUIPMENT ASSEMBLY & METAL STRUCTURE JSC)
Category
Strategic Planning
Year
2023 -2024

PET-C Project

Client
Category
Install
Year
2024

Twin Transformer Installation in Phnom Penh

Client
EDC / Siemens
Category
Installation
Year

Building 23 F, Poi Pet

Category
Pilling
Client
Poi Pet
Year
2023

Partners

document.addEventListener("DOMContentLoaded", function () {
    const sections = document.querySelectorAll("#section-0, #section-1, #section-2, #section-3, #section-4, #section-5, #section-6");
    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", "section-4", "section-5"].includes(section.id);
            const isRegularSection = ["section-1", "section-3", "section-6"].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 = -30; // Điều chỉnh offset cho các section đặc biệt
            } else if (isRegularSection) {
                offsetAdjustment = 10; // Đ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);
    }
});