Anzeigedauer des drop-Down Menüs verändern

Hi Leute,

könnt ihr mir weiterhelfen und sagen, an welcher Stelle ich im folgenden Quelltext etwas ändern muss, damit das aufklappende Menü länger zu sehen ist? Wenn ich mir der Maus rüberfahre, verschwindet es des öfteren…Der Code ist zwar ziemlich lang, dennoch wäre ich für Antworten echt dankbar.

Danke! Grüße, Patrick

/**
* mm_menu 20MAR2002 Version 6.0
* Andy Finnell, March 2002
* Copyright © 2000-2002 Macromedia, Inc.
*
* based on menu.js
* by gary smith, July 1997
* Copyright © 1997-1999 Netscape Communications Corp.
*
* Netscape grants you a royalty free license to use or modify this
* software provided that this copyright notice appears on all copies.
* This software is provided „AS IS,“ without a warranty of any kind.
*/
function Menu(label, mw, mh, fnt, fs, fclr, fhclr, bg, bgh, halgn, valgn, pad, space, to, sx, sy, srel, opq, vert, idt, aw, ah)
{
this.version = „020320 [Menu; mm_menu.js]“;
this.type = „Menu“;
this.menuWidth = mw;
this.menuItemHeight = mh;
this.fontSize = fs;
this.fontWeight = „plain“;
this.fontFamily = fnt;
this.fontColor = fclr;
this.fontColorHilite = fhclr;
this.bgColor = „#555555“;
this.menuBorder = 1;
this.menuBgOpaque=opq;
this.menuItemBorder = 1;
this.menuItemIndent = idt;
this.menuItemBgColor = bg;
this.menuItemVAlign = valgn;
this.menuItemHAlign = halgn;
this.menuItemPadding = pad;
this.menuItemSpacing = space;
this.menuLiteBgColor = „#ffffff“;
this.menuBorderBgColor = „#777777“;
this.menuHiliteBgColor = bgh;
this.menuContainerBgColor = „#FFFFFF“;
this.childMenuIcon = „arrows.gif“;
this.submenuXOffset = sx;
this.submenuYOffset = sy;
this.submenuRelativeToItem = srel;
this.vertical = vert;
this.items = new Array();
this.actions = new Array();
this.childMenus = new Array();
this.hideOnMouseOut = true;
this.hideTimeout = to;
this.addMenuItem = addMenuItem;
this.writeMenus = writeMenus;
this.MM_showMenu = MM_showMenu;
this.onMenuItemOver = onMenuItemOver;
this.onMenuItemAction = onMenuItemAction;
this.hideMenu = hideMenu;
this.hideChildMenu = hideChildMenu;
if (!window.menus) window.menus = new Array();
this.label = " " + label;
window.menus[this.label] = this;
window.menus[window.menus.length] = this;
if (!window.activeMenus) window.activeMenus = new Array();
}

function addMenuItem(label, action) {
this.items[this.items.length] = label;
this.actions[this.actions.length] = action;
}

function FIND(item) {
if( window.mmIsOpera ) return(document.getElementById(item));
if (document.all) return(document.all[item]);
if (document.getElementById) return(document.getElementById(item));
return(false);
}

function writeMenus(container) {
if (window.triedToWriteMenus) return;
var agt = navigator.userAgent.toLowerCase();
window.mmIsOpera = agt.indexOf(„opera“) != -1;
if (!container && document.layers) {
window.delayWriteMenus = this.writeMenus;
var timer = setTimeout(‚delayWriteMenus()‘, 600);
container = new Layer(100);
clearTimeout(timer);
} else if (document.all || document.hasChildNodes || window.mmIsOpera) {
document.writeln(’’);
container = FIND(„menuContainer“);
}

window.mmHideMenuTimer = null;
if (!container) return;
window.triedToWriteMenus = true;
container.isContainer = true;
container.menus = new Array();
for (var i=0; i\n’+
’ \n’+
’ \n’+
‚‘;
}
var x=i;
for (var i=0; i’;
var dClose = ’ ’
if (menu.bgImageUp) dTag = ’ ';

var left = 0, top = 0, right = 0, bottom = 0;
left = 1 + menu.menuItemPadding + menu.menuItemIndent;
right = left + menu.menuWidth - 2*menu.menuItemPadding - menu.menuItemIndent;
if( menu.menuItemVAlign == ‚top‘ ) top = menu.menuItemPadding;
if( menu.menuItemVAlign == ‚bottom‘ ) top = menu.menuItemHeight-menu.fontSize-1-menu.menuItemPadding;
if( menu.menuItemVAlign == ‚middle‘ ) top = ((menu.menuItemHeight/2)-(menu.fontSize/2)-1);
bottom = menu.menuItemHeight - 2*menu.menuItemPadding;
var textProps = ‚position:absolute;left:‘ + left + ‚px;top:‘ + top + ‚px;‘;
if (lrs) {
textProps +=itemProps + ‚right:‘ + right + ‚;bottom:‘ + bottom + ‚;‘;
dTag = „“;
dClose = „“;
}

if(document.all && !window.mmIsOpera) {
item = ’ ’ + item + ’ ';
} else if (lrs) {
item = ’ ’ + item + ’ ';
} else {
var hitem = null;
if( menu.menuItemHAlign != ‚left‘ ) {
if(window.mmIsOpera) {
var operaWidth = menu.menuItemHAlign == ‚center‘ ? -(menu.menuWidth-2*menu.menuItemPadding) : (menu.menuWidth-6*menu.menuItemPadding);
hitem = ’ ’ + item + ’ ';
item = ’ ’ + item + ’ ';
} else {
hitem = ’ ’ + item + ’ ';
item = ’ ’ + item + ’ ';
}
} else hitem = null;
}
if(document.all && !window.mmIsOpera) item = ’ ’ + item + ’ ‚;
var dText = ’ ‚+ item +‘  \n‘

  • ’ ’
  • (hitem||item) +’  ‚;
    if (childMenu) content += ( dTag + dText + ’ \n‘ + dClose);
    else content += ( dTag + dText + dClose);
    if (lrs) {
    l.document.open(„text/html“);
    l.document.writeln(content);
    l.document.close();
    content = ‚‘;
    theStat += „-“;
    tsc++;
    if (tsc > 50) {
    tsc = 0;
    theStat = „“;
    }
    status = theStat;
    }
    countItems++;
    }
    if (lrs) {
    var focusItem = new Layer(100, body);
    focusItem.visiblity=„hidden“;
    focusItem.document.open(„text/html“);
    focusItem.document.writeln(" ");
    focusItem.document.close();
    } else {
    content += ’   \n’;
    content += ’ \n \n\n’;
    }
    i=x;
    }
    if (document.layers) {
    container.clip.width = window.innerWidth;
    container.clip.height = window.innerHeight;
    container.onmouseout = mouseoutMenu;
    container.menuContainerBgColor = this.menuContainerBgColor;
    for (var i=0; i0) {
    if( l.Menu.vertical ) l.top = body.document.layers[n-1].top + body.document.layers[n-1].clip.height + proto.menuItemBorder + proto.menuItemSpacing;
    else l.left = body.document.layers[n-1].left + body.document.layers[n-1].clip.width + proto.menuItemBorder + proto.menuItemSpacing;
    }
    l.hilite = l.document.layers[1];
    if (proto.bgImageUp) l.background.src = proto.bgImageUp;
    l.document.layers[1].isHilite = true;
    if (l.document.layers.length > 2) {
    l.childMenu = container.menus[i].items[n].menuLayer;
    l.document.layers[2].left = l.clip.width -13;
    l.document.layers[2].top = (l.clip.height / 2) -4;
    l.document.layers[2].clip.left += 3;
    l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu;
    }
    }
    if( proto.menuBgOpaque ) body.document.bgColor = proto.bgColor;
    if( proto.vertical ) {
    body.clip.width = l.clip.width +proto.menuBorder;
    body.clip.height = l.top + l.clip.height +proto.menuBorder;
    } else {
    body.clip.height = l.clip.height +proto.menuBorder;
    body.clip.width = l.left + l.clip.width +proto.menuBorder;
    if( body.clip.width > window.innerWidth ) body.clip.width = window.innerWidth;
    }
    var focusItem = body.document.layers[n];
    focusItem.clip.width = body.clip.width;
    focusItem.Menu = l.Menu;
    focusItem.top = -30;
    focusItem.captureEvents(Event.MOUSEDOWN);
    focusItem.onmousedown = onMenuItemDown;
    if( proto.menuBgOpaque ) menu.document.bgColor = proto.menuBorderBgColor;
    var lite = menu.document.layers[0];
    if( proto.menuBgOpaque ) lite.document.bgColor = proto.menuLiteBgColor;
    lite.clip.width = body.clip.width +1;
    lite.clip.height = body.clip.height +1;
    menu.clip.width = body.clip.width + (proto.menuBorder * 3) ;
    menu.clip.height = body.clip.height + (proto.menuBorder * 3);
    }
    } else {
    if ((!document.all) && (container.hasChildNodes) && !window.mmIsOpera) {
    container.innerHTML=content;
    } else {
    container.document.open(„text/html“);
    container.document.writeln(content);
    container.document.close();
    }
    if (!FIND(„menuLayer0“)) return;
    var menuCount = 0;
    for (var x=0; x 0) MM_showMenu(null, „relative“, „relative“, l.layers[i]);
    }
    if (l.parentLayer) {
    if (x != „relative“) l.parentLayer.left = x || window.pageX || 0;
    if (l.parentLayer.left + l.clip.width > window.innerWidth) l.parentLayer.left -= (l.parentLayer.left + l.clip.width - window.innerWidth);
    if (y != „relative“) l.parentLayer.top = y || window.pageY || 0;
    if (l.parentLayer.isContainer) {
    l.Menu.xOffset = window.pageXOffset;
    l.Menu.yOffset = window.pageYOffset;
    l.parentLayer.clip.width = window.ActiveMenu.clip.width +2;
    l.parentLayer.clip.height = window.ActiveMenu.clip.height +2;
    if (l.parentLayer.menuContainerBgColor && l.Menu.menuBgOpaque ) l.parentLayer.document.bgColor = l.parentLayer.menuContainerBgColor;
    }
    }
    l.visibility = „inherit“;
    if (l.Menu) l.Menu.container.visibility = „inherit“;
    } else if (FIND(„menuItem0“)) {
    var l = menu.menuLayer || menu;
    hideActiveMenus();
    if (typeof(l) == „string“) l = FIND(l);
    window.ActiveMenu = l;
    var s = l.style;
    s.visibility = „inherit“;
    if (x != „relative“) {
    s.pixelLeft = x || (window.pageX + document.body.scrollLeft) || 0;
    s.left = s.pixelLeft + ‚px‘;
    }
    if (y != „relative“) {
    s.pixelTop = y || (window.pageY + document.body.scrollTop) || 0;
    s.top = s.pixelTop + ‚px‘;
    }
    l.Menu.xOffset = document.body.scrollLeft;
    l.Menu.yOffset = document.body.scrollTop;
    }
    if (menu) window.activeMenus[window.activeMenus.length] = l;
    MM_clearTimeout();
    }

function onMenuItemDown(e, l) {
var a = window.ActiveMenuItem;
if (document.layers && a) {
a.eX = e.pageX;
a.eY = e.pageY;
a.clicked = true;
}
}

function mouseupMenu(e) {
hideMenu(true, e);
hideActiveMenus();
return true;
}

function getExplorerVersion() {
var ieVers = parseFloat(navigator.appVersion);
if( navigator.appName != ‚Microsoft Internet Explorer‘ ) return ieVers;
var tempVers = navigator.appVersion;
var i = tempVers.indexOf( 'MSIE ’ );
if( i >= 0 ) {
tempVers = tempVers.substring( i+5 );
ieVers = parseFloat( tempVers );
}
return ieVers;
}

function mouseoutMenu() {
if ((navigator.appName == „Microsoft Internet Explorer“) && (getExplorerVersion() = e.pageX-15 && a.eY = e.pageY-10) {
setTimeout(‚window.ActiveMenu.Menu.onMenuItemAction();‘, 500);
}
}
a.clicked = false;
if (a.Menu.bgImageOver) a.background.src = a.Menu.bgImageUp;
} else if (window.ActiveMenu && FIND(„menuItem0“)) {
if (a) {
a.style.backgroundColor = a.saveColor;
if (a.hilite) a.hilite.style.visibility = „hidden“;
if (a.hiliteShim) a.hiliteShim.style.visibility = „inherit“;
if (a.Menu.bgImageUp) a.style.background = „url(“ + a.Menu.bgImageUp +")";
}
}
if (!mouseup && window.ActiveMenu) {
if (window.ActiveMenu.Menu) {
if (window.ActiveMenu.Menu.hideOnMouseOut) MM_startTimeout();
return(true);
}
}
return(true);
}

function hideChildMenu(hcmLayer) {
MM_clearTimeout();
var l = hcmLayer;
for (var i=0; i l.Menu.container.clip.width) l.Menu.container.clip.width = w;
var h = childMenu.clip.height+childMenu.top-l.Menu.container.clip.top;
if (h > l.Menu.container.clip.height) l.Menu.container.clip.height = h;
l.document.layers[1].zIndex = 0;
childMenu.visibility = „inherit“;
} else if (FIND(„menuItem0“)) {
childMenu = FIND(l.childMenu);
var menuLayer = FIND(l.Menu.menuLayer);
var s = childMenu.style;
s.zIndex = menuLayer.style.zIndex+1;
if (document.all || window.mmIsOpera) {
s.pixelTop = menuLayer.style.pixelTop + l.Menu.submenuYOffset;
if( l.Menu.vertical ) {
if( l.Menu.submenuRelativeToItem ) s.pixelTop += l.style.pixelTop;
s.pixelLeft = l.style.pixelWidth + menuLayer.style.pixelLeft + l.Menu.submenuXOffset;
s.left = s.pixelLeft + ‚px‘;
} else {
s.pixelTop += l.style.pixelTop;
if( l.Menu.submenuRelativeToItem ) s.pixelLeft = menuLayer.style.pixelLeft + l.style.pixelLeft + l.style.pixelWidth + (2*l.Menu.menuBorder) + l.Menu.submenuXOffset;
else s.pixelLeft = (menuLayer.style.pixelWidth-4*l.Menu.menuBorder) + menuLayer.style.pixelLeft + l.Menu.submenuXOffset;
s.left = s.pixelLeft + ‚px‘;
}
} else {
var top = parseInt(menuLayer.style.top) + l.Menu.submenuYOffset;
var left = 0;
if( l.Menu.vertical ) {
if( l.Menu.submenuRelativeToItem ) top += parseInt(l.style.top);
left = (parseInt(menuLayer.style.width)-4*l.Menu.menuBorder) + parseInt(menuLayer.style.left) + l.Menu.submenuXOffset;
} else {
top += parseInt(l.style.top);
if( l.Menu.submenuRelativeToItem ) left = parseInt(menuLayer.style.left) + parseInt(l.style.left) + parseInt(l.style.width) + (2*l.Menu.menuBorder) + l.Menu.submenuXOffset;
else left = (parseInt(menuLayer.style.width)-4*l.Menu.menuBorder) + parseInt(menuLayer.style.left) + l.Menu.submenuXOffset;
}
s.top = top + ‚px‘;
s.left = left + ‚px‘;
}
childMenu.style.visibility = „inherit“;
} else return;
window.activeMenus[window.activeMenus.length] = childMenu;
}
}

function hideActiveMenus() {
if (!window.activeMenus) return;
for (var i=0; i = 0) y += img.y;
return y;
}

Hi Patrick,
es ist etwas schwer deine Frage zu beantworten, da du nur die JS Funktionen gepostet hast und nicht deine dazugehörige HTML Seite mit der menu erschaffung. deshalb kann man das ganze schwer nachvollziehen.
Ich tippe einfach mal, dass die Funktion hideMenu(), mmDoHide() damit zusammenhängen. Achten solltest du hier auf die setTimeout JS-Funktion innerhalb der Funktionen. Diese rufen andere Funktionen mit Zeitverzögerung auf.
Der Programmierer hat sich hier Gedanken gemacht und bei der Benutzung der Menu() „Konstruktor“-Funktion einen Parameter vorgesehen name: to,
der die verzögerung vieler setTimeout Funktionen als Variable festlegen lässt. Die Variable in deinem Menu Objekt heißt nach der Ausführung der menu() Funktion dann hideTimeout.
beim menu() Aufruf sollte hier einfach ein größerer Wert für den Parameter angegeben werden.
Bei der hideMenu() Funktion hat allerdings jemand (du?) nicht die Variable verwendet, sondern einfach 500 eingetragen. Dieser Wert müsste dann auch von Hand erhöht werden. Die Zahlenangabe innerhalb der setTimeout Funktion ist übrigens ein Millisekundenwert.
Viel Erfolg weiterhin. Gruß DP