Viewer: Fix Carousel and error page
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -52,25 +52,25 @@ export const animateIn = scope => {
|
||||
|
||||
// Reveal on scroll
|
||||
let visible = false
|
||||
const carouselReveal = ScrollOut({
|
||||
once: true,
|
||||
targets: scope,
|
||||
onChange: (el, ctx) => {
|
||||
requestAnimationFrame(() => {
|
||||
requestAnimationFrame(() => {
|
||||
const carouselReveal = ScrollOut({
|
||||
once: true,
|
||||
targets: scope,
|
||||
onChange: (el, ctx) => {
|
||||
if (ctx.visible === 0) {
|
||||
visible = true
|
||||
}
|
||||
})
|
||||
},
|
||||
onShown: (el, ctx) => {
|
||||
// If revealed on scroll, no delay
|
||||
if (visible) {
|
||||
tl.restart()
|
||||
},
|
||||
onShown: (el, ctx) => {
|
||||
// If revealed on scroll, no delay
|
||||
if (visible) {
|
||||
requestAnimationFrame(() => tl.restart())
|
||||
}
|
||||
// If revealed on load, add a delay
|
||||
else {
|
||||
setTimeout(() => tl.restart(), animDelay * 2)
|
||||
}
|
||||
}
|
||||
// If revealed on load, add a delay
|
||||
else {
|
||||
setTimeout(() => tl.restart(), animDelay * 2)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -71,11 +71,13 @@
|
||||
const photoChanged = event => {
|
||||
const currentPhoto = event.detail
|
||||
const windowPathname = window.location.pathname
|
||||
const newUrl = windowPathname.substring(0, windowPathname.lastIndexOf('/') + 1) + currentPhoto.slug
|
||||
// Go to page via a sapper-noscroll link to avoid scroll jump (hacky)
|
||||
if (gotoLink && newUrl) {
|
||||
gotoLink.href = newUrl
|
||||
gotoLink.click()
|
||||
if (currentPhoto) {
|
||||
const newUrl = windowPathname.substring(0, windowPathname.lastIndexOf('/') + 1) + currentPhoto.slug
|
||||
// Go to page via a sapper-noscroll link to avoid scroll jump (hacky)
|
||||
if (gotoLink && newUrl) {
|
||||
gotoLink.href = newUrl
|
||||
gotoLink.click()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,10 +118,12 @@
|
||||
<circle cx="50%" cy="50%" r="{windowWidth >= 768 ? 32 : 24}px"></circle>
|
||||
</svg>
|
||||
</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">
|
||||
<IconCross color="#fff" width="18" class="icon" />
|
||||
<IconCross color="#fff" width="18" class="icon" hidden="true" />
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
<a href="/" bind:this={gotoLink} aria-hidden="true" hidden class="hidden" sapper-noscroll> </a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user