swup swup Variables
GitHub swup on GitHub


A few variables accessible in swup instance that could be helpful.


Holds information about the latest transition. Set at the beginning of the current transition to be used further on (right after the loadPage method call).

swup.transition ===
    from: '/about', // route of previous page
    to: '/team', // route of next page
    custom: 'slide-in' // content of [data-swup-transition] attribute or customTransition property passed to loadPage()


The URL of the page last navigated to, after any redirects.


Current options, after merging swup defaults and user options.


Array of all plugin instances currently enabled on swup.


Holds the hash/id of any element that needs to be scrolled to after navigation. Used by the scroll plugin.

// After clicking a link to /about#team
swup.scrollToElement === '#team';