README.md
December 4, 2022 ยท View on GitHub
Description
Using JavaScript, you can very easily make content expand and contact, like with a folding tree. I'll show you how.
More Info
| Submitted On | |
| By | Super Mario |
| Level | Intermediate |
| User Rating | 5.0 (15 globes from 3 users) |
| Compatibility | |
| Category | Controls/ Forms/ Graphics/ Menus |
| World | Java |
| Archive File |
Source Code
Using JavaScript, you can very easily make content expand and contact, like with
a folding tree. The key is the CSS property "display." I use it below to create
a header that expands/contacts when clicked on: </p>
<pre><script type="text/javascript">
function foldinout(theid){
var theid=document.getElementById(theid)
theid.style.display=(theid.style.display=="block")? "none" : "block"
}
</script>
<div onClick="foldinout('thelinks')"><b>Categories</b></div>
<div id="thelinks" style="display:block">
-Games
-Entertainment
-Movies
</div></pre>
<p>I love this "Switch Menu" script from Dynamic Drive, which makes excellent
use of this idea: http://www.dynamicdrive.com/dynamicindex1/switchmenu.htm</p>