Toggle - nonlinear/tangle GitHub Wiki
Toggles .title-active
class on any object with either .title-toggle
or .title-target
when .title-toggle
is clicked.
As any toggle, clicking 1st on .title-target
adds .title-active
and clicking 2nd time yanks it.
Add complex functions writing only CSS and HTML:
.title-target
is hidden, and.title-target.title-active
is visible.title-toggle
is (more examples here)
Need different functions on the same page? you can have different names, like .modal-*
for a modal function, .sidebar-*
for a sidebar, etc. They're all self contained.
Discuss: when removing .title-active
from object, add a .title-out
silent class for mere half second, then take it off too. This way it's easy to add out animations, too.