20. januar 2009 - 16:00Der er
6 kommentarer og 1 løsning
Menu-udvidelse vises forkert
Hej eksperter! :)
Min menu vises desværre forkert. Sub-menuerne skulle gerne vises ud for selve menu-punktet - I mit tilfælde, viser den dem desværre en "række" længere nede end det er meningen.
Jeg har forsøgt at lave om på position style't en del gange uden held.
Poster lige min kildekode i de næste beskeder, da det er nemmere at læse dér.
Javascript (popup.js) if (!document.all) document.captureEvents(Event.MOUSEMOVE)
// On the move of the mouse, it will call the function getPosition document.onmousemove = getPosition;
// These varibles will be used to store the position of the mouse var X = 0 var Y = 0
// This is the function that will set the position in the above varibles function getPosition(args) { div = document.getElementById('popupWindow');
if (div.style.display=='' || div.style.display=='none') { // Gets IE browser position if (document.all) { X = event.clientX + document.body.scrollLeft Y = event.clientY + document.body.scrollTop }
// Gets position for other browsers else { X = args.pageX Y = args.pageY } } }
function popUp() { var div;
if(document.getElementById) // Standard way to get element div = document.getElementById('popupWindow'); else if(document.all) // Get the element in old IE's div = document.all['popupWindow'];
// if the style.display value is blank we try to check it out here if(div.style.display==''&&div.offsetWidth!=undefined&&div.offsetHeight!=undefined) { div.style.display = (div.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none'; }
// If the PopUp is hidden ('none') then it will display it ('block'). // If the PopUp is displayed ('block') then it will hide it ('none'). div.style.display = (div.style.display==''||div.style.display=='block')?'none':'block';
// Off-sets the X position by 15px X = X - 5; Y = Y - 5;
// Sets the position of the DIV div.style.left = X+'px'; div.style.top = Y+'px'; }
function getHTTPObject() { var xhr = false; // Pre-defining the xhr variable if (window.XMLHttpRequest) { // Firefox, Safari, Opera and Netscape and IE7 all use this xhr = new XMLHttpRequest(); } else if (window.ActiveXObject) { // Below IE7 uses this try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); // IE 6 } catch(e) { try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); // IE 5 } catch(e) { xhr = false; // Browser seemingly does not support XHR }; }; }; return xhr; };
function ddCollapse(c){ c.timer = setInterval(function(){ddSlide(c,-1)},DDTIMER); }
function cancelHide(id){ var h = document.getElementById(id + '-ddheader'); var c = document.getElementById(id + '-ddcontent'); clearTimeout(h.timer); clearInterval(c.timer); if(c.offsetHeight < c.maxh){ c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER); } }
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.