Scroll To Top

Enter a query to search our site. Note that you can use "*" and "?" as wildcards. Enclosing more than one word in double quotes ("CSS Layout") will search for the exact phrase.

PVII Knowledge Base

1. Select a product ...
2. Select category ...
3. Search the Knowledge Base...

Question #273

Can the animation in the Tree Menu Magic 2 (TMM2) system be set to animate the closing of the sub menu?

The Answer

Prepared Oct. 2009 by Gerry Jacobsen, PVII

By default the closing of the sub menus in Tree Menu Magic 2 (TMM2) is not animated, in order to speed the operation of the menu. You can apply this simple tweak to turn on animation for the closing sub menu:

1. Open the p7TMMscripts.js file, scroll down to the end of the file, make a new line and Copy & Paste these two new functions into that new line:

function P7_TMManimClose(tD,bp,op){
  var v,cl,cw,tw,ch,th,st,frh,dy=10,du=100;
  var tU=tD.getElementsByTagName('UL')[0];
  if(!bp&&p7TMMa&&op>0){
    st=du/dy;
    th=tU.offsetHeight;
    tw=tU.offsetWidth;
    frh=parseInt(th/st);
    frh=(frh<1)?1:frh;
    P7_TMManimUp(tD.id,th,0,op,frh,v,tU.id,dy);
  }else{
    tD.style.display='none';
 }
}

function P7_TMManimUp(id,ch,th,op,frh,v,tu,dy){ var el,nh; el=document.getElementById(id); el.style.height=ch+'px'; if(ch>th){ nh=ch-frh; nh=(nh<=th)?th:nh; setTimeout("P7_TMManimUp('"+id+"',"+nh+","+th+","+op+","+frh+","+v+",'"+tu+"',"+dy+")",dy); }else{ el.style.display="none"; el.style.height='auto'; } }

2. Locate the last three lines of the P7_TMMclose(a,bp) function, around line 376:

   tD.style.display='none';    
   tD.p7state='closed';
 }

3. Replace the first two lines with these new code lines:

   tD.p7state='closed';    
   P7_TMManimClose(tD,bp,tM.p7opt[1]);

into the new line so that it now looks like this:

    tD.p7state='closed';
    P7_TMManimClose(tD,bp,tM.p7opt[1]);
 }

3. Save and close the file.

That's it! The TMM2 system will now animate the closing of each sub menu.

Back to the questions list