PVII Knowledge Base
Question #272
With Pop Menu Magic 2 (PMM2) is there a way to have the sub menu that corresponds to the current page be always open and visible (persistent)? allow the sub menu hide when there is user action on the menu but then show the sub when the menu is at rest?
The Answer
Prepared Oct. 2009 by Gerry Jacobsen, PVIIYou can apply a simple code tweak for the Pop Menu Magic 2 (PMM2) system that will set the sub menu that corresponds with the "Current Marked" link to open automatically when the page first loads, and stay open (persistent) when the menu is not being used. When there is user action on the menu the sub will hide and allow normal menu mouse over action. When the user mouses away form the menu the "persistent" sub menu will be made visible again and stay visible while the menu is at rest.
See how this tweak works on this simple example page.
To apply the tweak:
1. Open the p7PMMscripts.js file, scroll to the end of the file and a new line and then paste this new function into that new line:
function P7_PMMpersist(d){
var a,tB;
a=document.getElementById(d)
if(a&&a.pmmsub){
tB=document.getElementById(a.pmmsub);
tB.p7persist=true;
P7_PMMtrig(a);
}
}2. Locate this block of code in the P7_PMMshut(d) function, around line 271:
if(tD[k].p7state&&tD[k].p7state=='open'){
P7_PMMclose(tD[k]);
}
}
4. Make a new line right after the third line (the first }) and paste this code into the new line:
if(tD[k].p7persist){
var a=document.getElementById(tD[k].p7trigger);
P7_PMMtrig(a);
}
so that it now looks like this:
if(tD[k].p7state&&tD[k].p7state=='open'){
P7_PMMclose(tD[k]);
}
if(tD[k].p7persist){
var a=document.getElementById(tD[k].p7trigger);
P7_PMMtrig(a);
}
}
5. Now, to modify the current marker to set the sub(s) to persistent, locate this code block in the P7_PMMcurrentMark(el) function, around line 607:
im.src=im.p7imgswap[3];
}
}
}
else{
6. Make a new line right after the second line (the first }) and paste this code into the new line:
if(a[0].pmmsub){P7_PMMpersist(a[0].id);}
so that it now looks like this:
im.src=im.p7imgswap[3];
}
if(a[0].pmmsub){P7_PMMpersist(a[0].id);}
}
}
else{
7. Save and close the file.
That's it! The sub menu(s) correlating to the current marked link will now show automatically and stay open (persistent) when the menu is at rest.
