show/hide one way or another
In your web page include:
<script src="jquery.js"></script>
<script src="showa.js"></script>
And add some Elements:
<span class="animal" id="rabbit">Bugs Bunny</span>
<span class="animal" id="bird">Flamingo</span>
<span class="human" id="jane">Jane Doe</span>
<script>
//animals
showa.addElement(".animal", true);
showa.addElement("#rabbit", true);
showa.addElement("#bird", true);
//humans
showa.addElement(".human", true);
showa.addElement("#jane", true);
</script>
Now run:
/**
* @param {string} way to show/hide
* @param {string} selector
*/
showa.do('showOnly', '#bird');
Available Options:
- showOnly -> show selected and hide all others
- showOne -> show selected
- hideOnly -> hide selected and show all others
- hideOne -> hide selected
- reversAll -> show all Hidden and hide all Shown
Add element:
/**
* @param {string} selector
* @param {bool} state show=true, hide=false
*/
showa.addElement(".human", false);
Remove element:
/**
* @param {string} selector
*/
showa.rmElement(".human");
##Tip
var showa2 = new Showa();