Toggle
Toggle

Toggle is a plugin for all interactions that toggle a class and respond to it.

Javascript

Import the javascript file with import 'xtendui/src/toggle'.

Initialize automatically within markup with [data-xt-toggle="{ <options> }"].

Initialize manually within javascript with new Xt.Toggle(document.querySelector('.my-container'), {/* options */}).

Usage Self

Use this code to create a toggle in self mode.

Usage Unique

Use this code to create a toggle in unique mode.

The unique mode is useful when you want to trigger targets outside the scope.

Only when you specify elements or targets with id the query is inside document not only inside object.

Usage Multiple

Use this code to create a toggle in multiple mode.

Implementation

Check out toggle themes for advanced implementations.