@wide/pageflip
v2.1.1
Published
Handle page transition when navigating
Keywords
Readme
Pageflip
Handle page transition when navigating, based on pjax.
Install
npm install @wide/pageflip --saveUsage
import pageflip from '@wide/pageflip'
pageflip({
container: 'main',
transition: 'fadeUp',
transitions: {
fadeUp: {
from: el => fadeUpOut(el),
to: el => fadeUpIn(el)
}
}
})container: selector of the element to update when the next page is loaded, defaultmaintransition: default transition to apply, defaultnooptransitions: collection of available transitionsenter: called when the next page is loading, must return aPromiseleave: called whenenteris resolved and the next page is loaded, ready to swap
Default transitions
Pageflip comme with 2 defaults transitions:
noopdo absolutely nothing, swap directly the next pagefadea simple fade in/out of the page
Lifecycle and hooks
Pageflip apply the following process:
click -> onLoad() -> transition.enter() -> page is -> onSwap() -> transition.leave()
on link loadedYou can interact around onLoad() and onSwap() with these hooks :
pageflip({
beforeLoad(),
afterLoad(),
beforeSwap(),
afterSwap()
})Libraries
This package uses :
Authors
- Aymeric Assier - github.com/myeti
- Julien Martins Da Costa - github.com/jdacosta
License
This project is licensed under the MIT License - see the licence file for details
