Full Toggle TreeMenu Magic

There are occasions when you would like the TMM system to automatically toggle the open submenu each time you click a menu button. This will assure that only one menu section is open at any time. This tweak will create a complete, full toggle for every section and level in the menu. When a link is clicked, all other open menu sections in the menu will be closed while keeping all of the parent sections of this link open.

This tweak is strictly to the JavaScript and will require no extra html markup or other modifications.

Version history:

1.2, Feb 18,2004, fixes an issue with Mac IE5.x browsers.

1.3, Mar 1,2004, fixes "currentmark" class toggle issue.

1.4, Mar 3,2004, fixes a recursion issue.

How to...

You can use this special JavaScript function, P7_TMfull().

Here's the function:

function P7_TMfull(tL){ //v1.4 by Project Seven Development(PVII)
var i,x,pp,pa,d,ha,s,tN,tA,c,k,j,pd,pc,m;
var tD=new Array(),tAA=new Array();
if(pp.tagName&&pp.tagName=="DIV"){if(pp.id &&pp.id=="p7TMnav"){
if(tA[i].parentNode && tA[i].parentNode.childNodes){
if(tAA[i].parentNode && tAA[i].parentNode.childNodes){

Here's how it works :

1. Copy and paste this new JavaScript function, P7_TMfull(), into your p7tmscript.js file, or use the complete JavaScript from this page source.

2. Next, we'll make a code tweak to the P7_TMenu() function:

-Add this right after the first line of the script:


-the modified function should look like this:

function P7_TMenu(b,og) { //v2.5 by Project Seven Development(PVII)
var i,s,c,k,j,tN,hh;if(document.getElementById){
if(b.parentNode && b.parentNode.childNodes){tN=b.parentNode.childNodes;}else{return;}

3. Save the JavaScript file.

That's It!

Now the menu system will toggle on every click to show one submenu section at a time.

Note that this Full Toggle tweak will assure that only one menu section is open at a time, consequently it will interfere with the Expand-All and Collapse-All TMM behaviors. It is recommended that you do not use the Expand/Collapse All feature when deploying the menu with the Full Toggle tweak.

Tree Menu Magic by PVII
imagine the possibilities