DHTML Lab: Hierarchical Menus, III; Frames - Menu Hiding | WebReference

DHTML Lab: Hierarchical Menus, III; Frames - Menu Hiding

home / experts / dhtml / column18

Hierarchical Menus in Frames
menu hiding

All the functions associated with hiding the menus, either in full or just child menus, do not change for the frames version of the script. They are discussed in the first hierarchical menu column and are simply reproduced here for reference.

function popDown(menuName){ 
  if (!areCreated) return;
  whichEl = eval(menuName);
  whichEl.isOn = false;
  whichEl.hideTop();
}
function hideAll() {
  for(i=1; i<topCount; i++) {
    temp = eval("elMenu" + i);
    temp.isOn = false;
    if (temp.hasChildVisible) temp.hideChildren();
    temp.showIt(false);
  }  
}
    
function hideTree() { 
  allTimer = null;
  if (isOverMenu) return;
  if (this.hasChildVisible) {
    this.hideChildren();
  }
  this.hideParents();
}
function hideChildren(item) {
  if (this.visibleChild.hasChildVisible) {
    this.visibleChild.visibleChild.showIt(false);
    this.visibleChild.hasChildVisible = false;
  }
  if (!this.isOn || !item.hasMore
      || this.visibleChild != this.child) {
    this.visibleChild.showIt(false);
    this.hasChildVisible = false;
  }
}
function hideParents() {     
  if (this.hasParent) {
    this.showIt(false);
    if (this.parentMenu.hasParent) {
      this.parentMenu.isOn = false;    
      this.parentMenu.showIt(false);
      this.parentMenu.parentMenu.isOn = false;
      whichEl = this.parentMenu.parentMenu
    }
    else {
      this.parentMenu.isOn = false;
      whichEl = this.parentMenu;
    }
  }
  else {
    whichEl = this;
  }
  whichEl.hideTop();
}
function hideTop() {
  whichEl = this;
this.hideTimer=setTimeout("whichEl.hideSelf()",mSecsVis);
}
function hideSelf() {
  this.hideTimer = null;
  if (!this.isOn && !isOverMenu) { 
    this.showIt(false);
  }
}

That wraps it up for the script. The final part of our technique involves ensuring that after the frameset has been established, all new pages that load into the main frame generate menus.


Produced by Peter Belesis and

All Rights Reserved. Legal Notices.
Created: Apr. 08, 1998
Revised: Apr. 08, 1998

URL: http://www.webreference.com/dhtml/column18/menuFrHide.html