Plugins
Swup is small by design. Extended features can be added via plugins.
See below for a list of all official plugins.
Installing plugins
Install and import the plugin via npm and your bundler:
npm install @swup/scroll-plugin
npm install @swup/scroll-plugin
import Swup from 'swup';
import SwupScrollPlugin from '@swup/scroll-plugin';
import Swup from 'swup';
import SwupScrollPlugin from '@swup/scroll-plugin';
Enable the plugin at initialisation of swup by including it in the options:
const swup = new Swup({
plugins: [new SwupScrollPlugin()]
});
const swup = new Swup({
plugins: [new SwupScrollPlugin()]
});
Alternatively, you can use swup's use
& unuse
methods to add or remove plugins after intialization.
const swup = new Swup();
swup.use(new SwupScrollPlugin());
const swup = new Swup();
swup.use(new SwupScrollPlugin());
Accessing plugin instances
Use swup's findPlugin
method to find and manipulate plugin instances directly.
const pluginInstance = swup.findPlugin('SwupScrollPlugin');
const pluginInstance = swup.findPlugin('SwupScrollPlugin');
In this Section
- Accessibility Plugin
- Body Class Plugin
- Custom Payload Plugin
- Debug Plugin
- Forms Plugin
- Fragment Plugin
- GA Plugin
- Gia Plugin
- GTM Plugin
- Head Plugin
- JS Plugin
- Laravel Livewire Plugin
- Matomo Plugin
- Parallel Plugin
- Preload Plugin
- Progress Bar Plugin
- Route Name Plugin
- Scripts Plugin
- Scroll Plugin
- Create a Plugin 🎉