Show and hide elements when other elements are clicked
-
map(array mapping)
Provide a mapping of elements to OTHER elements that should be shown when clicked.
mappingis an array of objects that look like:{ on: $el, show: $el}. When the on $el is clicked, all theshow$elements but the one in the pairing are hidden.
require('toggleable').map([
{ on: $('.one'), show: $('other') },
{ on: $('.two'), show: $('another') }
]).showFirst();