Fix the transition as it would get stuck sometimes
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
- Reproduction: Open two tabs, one would load, the other one would stay on the transition while the content of the page was ready and animated
This commit is contained in:
@@ -31,10 +31,10 @@
|
||||
page.subscribe(page => {
|
||||
// Show transition if page is not excluded
|
||||
if (!isExcluded(previousPage) || !isExcluded(page.path)) {
|
||||
// Show transition
|
||||
show = false
|
||||
// Reset pageReady
|
||||
pageReady.set(false)
|
||||
process.browser && requestAnimationFrame(() => {
|
||||
show = false
|
||||
})
|
||||
}
|
||||
|
||||
// Update page for viewer navigation checking
|
||||
@@ -45,14 +45,14 @@
|
||||
pageReady.subscribe(loaded => {
|
||||
if (loaded) {
|
||||
setTimeout(() => {
|
||||
// Show transition
|
||||
// Hide transition
|
||||
show = true
|
||||
// Run the page animation
|
||||
process.browser && requestAnimationFrame(animateIn)
|
||||
// Change loader icon as the loader shown already
|
||||
firstLoad.set(false)
|
||||
// Run page animation
|
||||
animateIn()
|
||||
// Scroll to page top
|
||||
window.scrollTo(0,0)
|
||||
// Change loader as the init one shown already
|
||||
firstLoad.set(false)
|
||||
}, $firstLoad ? animPanelDelay : animPanelShortDelay)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user