Local toggles change the className of the parentNode rather than the documentElement for isolating state to part of the DOM
$ npm i -S storm-toggler
Sample minimum CSS as an indication how the global toggle works
Either import and initialise using a named import:
import Toggler from 'storm-toggler';
Toggler.init('.js-toggler');
Or async using storm-load.js, add the .standalone file to your project, then initialise using the global name:
Load('/content/js/async/storm-toggler.standalone.js')
.then(() => {
StormToggler.init('.js-toggler');
});
Sample minimum CSS as an indication how the local toggle works
Either import and initialise using a named import:
import Toggler from 'storm-toggler';
Toggler.init('.js-toggle__local', {
local: true
});
Or async using storm-load.js, add the .standalone file to your project, then initialise using the global name:
Load('/content/js/async/storm-toggler.standalone.js')
.then(() => {
StormToggler.init('.js-toggle__local', {
local: true
});
});