Skip to content

Instantly share code, notes, and snippets.

@harryqt
harryqt / +page.svelte
Created October 12, 2025 13:09
Svelte 5 + Runed Scroll-Aware Moving Ad Block
<script>
import { onMount } from 'svelte';
import { useIntersectionObserver, ScrollState } from 'runed';
import { randomInt } from 'es-toolkit';
let boxes = Array.from({ length: 40 });
let adIndex = $state(8);
let scroll;
let wasIntersecting;