How to animate vertical line depend on element position?

I’m trying to animate a vertical line depending on the positions of elements on the page. Here’s an example of what I want to achieve.

I tried to do something like this

    <section id="s1">
        <div class="page-container">
            <div class="row">
                <div class="col">
                    <div>
                        <p class="about-text-title">Label1</p>
                        <p class="about-text">Lorem ipsum, dolor sit amet consectetur adipisicing elit. Provident nulla iure quod autem amet, ipsa beatae
                            voluptatibus maiores adipisci quae, expedita deserunt laborum architecto corporis dolore. Voluptates tenetur nisi
                            cupiditate?</p>
                    </div>
                </div>
                <div class="col vertical-line"></div>
                <div class="col">
                    <p>Video frame</p>
                </div>
            </div>
        </div>
    </section>
    <section id="s2">
        <div class="container">
            <div class="row">
                <div class="col">
                    <p>Label2</p>
                    <p class="about-text">Lorem ipsum, dolor sit amet consectetur adipisicing elit. Provident nulla iure quod autem amet, ipsa beatae
                            voluptatibus maiores adipisci quae, expedita deserunt laborum architecto corporis dolore. Voluptates tenetur nisi
                            cupiditate?</p>
                </div>
                <div class="col">
                    <p>Another video frame</p>
                </div>
            </div>
        </div>
    </section>
.row {
    display: flex;
    justify-content: space-between;
}

.col {
    padding-left: 8.125rem;
    padding-right: 8.125rem;
    align-self: center;

    flex: 1;
    padding: 20px;
    position: relative;
}

.vertical-line {
    content: '';
    border-left: 1px solid var(--primary-text);
    border-right: 1px solid var(--primary-text);
    padding: 0;
    position: absolute;
    height: 48.75rem;
    right: 50%;

    transition: transform 1s;
}

@keyframes moveLine {
    0% { transform: translateX(0); }
    100% { transform: translateX(50px); }
} */

.hidden {
    visibility: hidden;
}
document.addEventListener('DOMContentLoaded', function() {
    const line = document.querySelector('.vertical-line');
    const sections = document.querySelectorAll('section');

    let options = {
        root: null,
        rootMargin: '0px',
        threshold: 0.1
    };

    let observer = new IntersectionObserver((entries, observer) => {
        entries.forEach(entry => {
            if (entry.isIntersecting) {
                entry.target.classList.remove('hidden');
            } else {
                entry.target.classList.add('hidden');
            }
        });
    }, options);

    sections.forEach(section => {
        observer.observe(section);
    });

    let scrollDirection = 'down';
    let lastScrollTop = 0;

    window.addEventListener('scroll', () => {
        let st = window.scrollY || document.documentElement.scrollTop;

        if (st > lastScrollTop) {
            scrollDirection = 'down';
        } else {
            scrollDirection = 'up';
        }
        lastScrollTop = st <= 0 ? 0 : st;

        if (scrollDirection === 'down') {
            line.style.transform = 'translateX(50vw)';
        } else {
            line.style.transform = 'translateX(-50vw)';
        }
    });
});

The line actually moves depending on the scroll, but it moves to the extreme position of the screen and when I stop scrolling it moves to the place where it is by default (on the left). But most importantly, it does not paint over the elements of section 1 and the elements of section 2 do not appear after it.

I don’t really know how to do this. What I actually want to do is “paginate”, so that this line will scroll the page, updating the elements.

Please tell me how to do this? I will be glad for any help. p.s. Sorry if I didn’t explain it well, I’m really bad at html, css, js.

I tried to reproduce the provided example using javascript and css, but it doesn’t work as I wanted.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật