Viewer: Fix Carousel and error page
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2020-04-22 10:33:48 +02:00
parent 3a96b8e954
commit 74743fb037
2 changed files with 25 additions and 21 deletions

View File

@@ -52,20 +52,19 @@ export const animateIn = scope => {
// Reveal on scroll // Reveal on scroll
let visible = false let visible = false
requestAnimationFrame(() => {
const carouselReveal = ScrollOut({ const carouselReveal = ScrollOut({
once: true, once: true,
targets: scope, targets: scope,
onChange: (el, ctx) => { onChange: (el, ctx) => {
requestAnimationFrame(() => {
if (ctx.visible === 0) { if (ctx.visible === 0) {
visible = true visible = true
} }
})
}, },
onShown: (el, ctx) => { onShown: (el, ctx) => {
// If revealed on scroll, no delay // If revealed on scroll, no delay
if (visible) { if (visible) {
tl.restart() requestAnimationFrame(() => tl.restart())
} }
// If revealed on load, add a delay // If revealed on load, add a delay
else { else {
@@ -73,4 +72,5 @@ export const animateIn = scope => {
} }
} }
}) })
})
} }

View File

@@ -71,6 +71,7 @@
const photoChanged = event => { const photoChanged = event => {
const currentPhoto = event.detail const currentPhoto = event.detail
const windowPathname = window.location.pathname const windowPathname = window.location.pathname
if (currentPhoto) {
const newUrl = windowPathname.substring(0, windowPathname.lastIndexOf('/') + 1) + currentPhoto.slug const newUrl = windowPathname.substring(0, windowPathname.lastIndexOf('/') + 1) + currentPhoto.slug
// Go to page via a sapper-noscroll link to avoid scroll jump (hacky) // Go to page via a sapper-noscroll link to avoid scroll jump (hacky)
if (gotoLink && newUrl) { if (gotoLink && newUrl) {
@@ -78,6 +79,7 @@
gotoLink.click() gotoLink.click()
} }
} }
}
/* /*
@@ -116,10 +118,12 @@
<circle cx="50%" cy="50%" r="{windowWidth >= 768 ? 32 : 24}px"></circle> <circle cx="50%" cy="50%" r="{windowWidth >= 768 ? 32 : 24}px"></circle>
</svg> </svg>
</a> </a>
{#if $currentLocation}
<a href="/location/{$currentLocation.country.slug}/{$currentLocation.slug}" class="button-control button-control--pink dir-bottom" aria-label="Back to photos" rel="prefetch"> <a href="/location/{$currentLocation.country.slug}/{$currentLocation.slug}" class="button-control button-control--pink dir-bottom" aria-label="Back to photos" rel="prefetch">
<IconCross color="#fff" width="18" class="icon" /> <IconCross color="#fff" width="18" class="icon" />
<IconCross color="#fff" width="18" class="icon" hidden="true" /> <IconCross color="#fff" width="18" class="icon" hidden="true" />
</a> </a>
{/if}
</div> </div>
<a href="/" bind:this={gotoLink} aria-hidden="true" hidden class="hidden" sapper-noscroll>&nbsp;</a> <a href="/" bind:this={gotoLink} aria-hidden="true" hidden class="hidden" sapper-noscroll>&nbsp;</a>
</div> </div>