Skip to content

Instantly share code, notes, and snippets.

View ahsan-a's full-sized avatar

ahsan-a ahsan-a

View GitHub Profile
@ahsan-a
ahsan-a / index.html
Created April 9, 2021 13:00
Javascript scroll snapping every 100vh without CSS
<script>
window.addEventListener('scroll', (e) => {
let scrolled = window.pageYOffset;
setTimeout(() => {
if (scrolled == window.pageYOffset) {
if (
scrolled % window.innerHeight >=
window.innerHeight / 2
) {
window.scrollBy(