thanks to kangax, justin, matt and bluezehn I now have firebug and
some semi-working code.
this almost works but for some reason the Organisation menu works
fine, the second menu - System setup gets the hover for the first ul
but doesn't for the li, and the reconcilation responses menu does
nada. - any ideas my hair is getting thinner by the minute
document.observe('dom:loaded', function(){
alert('DOM is loaded!');
element = $('menu');
if (!element.hasClassName('disabled')) {
document.menu = new JMenu(element);
}
});
//var JMenu = new Class({ // removed pd
var JMenu = Class.create({ // added pd
initialize: function(el){
// var elements = $ES('li', el);
// var elements = $('menu').getElementsBySelector('li');
var elements = $(el).select('li');
//alert(elements.length);
var nested = null;
for (var i=0, l=elements.length; i<l; i++) {
var element = elements[i];
console.log(i);
//alert(elements.length);
//
element.addEvent('mouseover', function()
{ this.addClass('hover'); });
//
element.addEvent('mouseout', function()
{ this.removeClass('hover'); });
Event.observe(element, 'mouseover', function(){
this.addClassName('hover');
// alert('added hover event');
});
Event.observe(element, 'mouseout', function(){
this.removeClassName('hover');
});
//find nested UL
//nested = $E('ul', element);
nested = element.select('ul')[0];
if (!nested) {
continue;
}
//declare width
var offsetWidth = 0;
//find longest child
for (k = 0; k < nested.childNodes.length; k++) {
var node = nested.childNodes[k]
if (node.nodeName.toLowerCase == 'li')
offsetWidth = (offsetWidth >=
node.offsetWidth) ? offsetWidth :
node.offsetWidth;
}
//match longest child
for (l = 0; l < nested.childNodes.length; l++) {
var node = nested.childNodes[l]
if (node.nodeName.toLowerCase == 'li') {
$(node).setStyle('width',
offsetWidth + 'px');
}
}
$(nested).setStyle('width', offsetWidth + 'px');
}
}
});
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---