You can do it easly with gsap
<script>
import { onMounted, onBeforeUnmount, ref } from 'vue';
import gsap from 'gsap';
import { ScrollToPlugin } from 'gsap/ScrollToPlugin';
gsap.registerPlugin(ScrollToPlugin);
export default {
setup() {
const containerRef = ref(null);
function handleScroll(event) {
if (containerRef.value) {
event.preventDefault();
const container = containerRef.value;
const { deltaY, delateX } = event;
// Reverse scroll: delta > 0 means scroll left
const newScrollY = container.scrollLeft + deltaY;
gsap.to(container, {
scrollTo: {
x: newScrollY,
autoKill: true,
},
duration: 0.5,
ease: 'power2.out',
});
}
}
onMounted(() => {
const el = containerRef.value;
if (el) {
el.addEventListener('wheel', handleScroll, { passive: false });
}
});
onBeforeUnmount(() => {
const el = containerRef.value;
if (el) {
el.removeEventListener('wheel', handleScroll);
}
});
return {
containerRef,
};
},
};
</script>
<template>
<main>
<div class="layout-wrapper">
<div class="horizontal-container" ref="containerRef">
<div class="horizontal-section">1 ProjectsSection</div>
<div class="horizontal-section">2 ContactSection</div>
<div class="horizontal-section">3 HomeSection</div>
</div>
<footer>
<p>© 2025 Onyedikachukwu Okonkwo</p>
</footer>
</div>
</main>
</template>
<style>
.horizontal-container {
height: calc(100vh - 100px);
width: auto;
display: flex;
flex-direction: row;
align-items: center;
overflow: hidden; /* Disable native scroll */
position: relative;
}
.horizontal-section {
width: 100vw;
height: 100%;
min-height: 100%;
min-width: 100vw;
display: flex;
justify-content: center;
align-items: center;
}
</style>
You can play around with it in: https://stackblitz.com/edit/vue-rwffnzpr?file=src%2FApp.vue