conceal-reveal.js
A tiny vanilla-js library to conceal/reveal elements.
Demo
API
conceal(element: HTMLElement): void
Conceals the element.
reveal(element: HTMLElement): void
Reveals the concealed element.
toggle(element: HTMLElement): void
If the element is concealed, reveals the element, otherwise conceals the element.
concealed(element: HTMLElement): boolean
Returns whether the element is concealed (including transitioning to be concealed).
Installation
npm (with a module bundler)
via$ npm i conceal-reveal
jsDelivr)
via CDN (
or for modern browsers:
How to
Default concealment
This content is visible by default and can be concealed.This content is concealed by default and can be revealed.
Customize transitions
conceal-reveal.js uses CSS transitions.
You can override the transition properties for whole elements or specific elements.
/* part of conceal-reveal.css */
/* your css *//* overriding transitions for whole elements */ /* overriding transitions for specific element */