Skip to content

Commit

Permalink
fix: images url
Browse files Browse the repository at this point in the history
  • Loading branch information
Valexr committed Apr 24, 2024
1 parent d61b1df commit 2f211b8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@
dates.del(Number(id));
}
function intersection(section: HTMLElement) {
const observer = new IntersectionObserver(observe, {
root: document.body,
rootMargin: "0px",
threshold: 0,
});
observer.observe(section);
function observe(entries: IntersectionObserverEntry[]) {
const active = entries.find((e) => e.isIntersecting);
console.log(entries, active);
}
}
$: console.log($date);
</script>

Expand All @@ -46,7 +59,7 @@
{#await images.back() then}
<main>
{#each $counters as counter, id}
<section>
<section use:intersection id={String(id)}>
<header>
<DateForm {id} {counter} />
</header>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/images.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function createImages() {

async function load() {
if (!get().length) {
const url = 'https://valexr.github.io/county/assets/photos.json';
const url = './assets/photos.json';
const res = await fetch(url);
set(await res.json());
}
Expand Down

0 comments on commit 2f211b8

Please sign in to comment.