diff options
| author | Kyren223 <contact@kyren.codes> | 2025-10-04 13:11:50 +0300 |
|---|---|---|
| committer | Kyren223 <contact@kyren.codes> | 2025-10-04 13:11:50 +0300 |
| commit | c283410934581ff2920e06c5b6372646a62f85f4 (patch) | |
| tree | 0007eab093f402676dd5231d5d7912f553d95f45 /src/pages | |
| parent | 52764a9b61da961a6968e4b1a8aff5978e3448d0 (diff) | |
Allow scrolling outside the "box" in blog posts (for martins)
Diffstat (limited to 'src/pages')
| -rw-r--r-- | src/pages/blogs/[...slug].astro | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/pages/blogs/[...slug].astro b/src/pages/blogs/[...slug].astro index 7dae497..a7394ca 100644 --- a/src/pages/blogs/[...slug].astro +++ b/src/pages/blogs/[...slug].astro @@ -24,7 +24,7 @@ const nextBlog = sortedBlogs[currentIndex - 1] || undefined; --- <Terminal path="/home/kyren/blogs/"> - <div class="w-full h-[85svh] sm:h-[30vw] overflow-y-auto pr-[1.25vw] border-box"> + <div class="blog-scroll w-full h-[85svh] sm:h-[30vw] overflow-y-auto pr-[1.25vw] border-box"> <div class="text-[130%] h-full"> <div class="text-[110%]"> <BlogItem @@ -114,3 +114,19 @@ const nextBlog = sortedBlogs[currentIndex - 1] || undefined; margin-bottom: 1em; } </style> + +<script> + document.addEventListener('wheel', (e) => { + const box = document.querySelector('.blog-scroll'); + if (!box) return; + + // If scrolling the page itself, forward it to the box + const atTop = box.scrollTop === 0 && e.deltaY < 0; + const atBottom = box.scrollHeight - box.scrollTop === box.clientHeight && e.deltaY > 0; + + if (!atTop && !atBottom) { + box.scrollTop += e.deltaY; + e.preventDefault(); + } + }, { passive: false }); +</script> |
