Happy states!

A small script that manages your pages state via document.documentElement.classlist. 😎

Used configuration:

var states = new States('coolPrefix-');

Test on these elements:


“I am a <p> element and I switch states using the data-state attribute (I have no callback).”


Current document.documentElement.classList: