Hello to all,
I have a little problem with my accordion menu and I CRAVE for your help!:krazy:
I try to make this: when you visit my page I need the menu to be all collapsed.
Also the history of clicks (it remembers which menus where left opened) works fine on IE but not on firefox. :huh:
Here is the js code:
[COLOR=Blue]function add_menu_event_handlers()
{
var elems = document.getElementsByTagName(‘h3’);
for (i = 0; i < elems.length; i++)
{
switch (elems*.parentNode.className)
{
/case ‘moduletable’:
case ‘moduletable_menu’:/
case ‘left_module_title’:
case ‘left_module_title_menu’:
{
if (elems*.parentNode.parentNode.parentNode.id == ‘xp-left’)
{
xplike_addEvent(elems*, ‘click’, function(){menu_header_click(this);});
// menu_header_click(elems*);
//Load status from cookies and collapse if required
var cookie_array = document.cookie.split(’;’);
for(var j=0; j<cookie_array.length; j++)
{
var c = cookie_array[j];
while (c.charAt(0)==’ ‘) c = c.substring(1,c.length);
if (c.indexOf(‘xplike_menu_status_’ + elems*.firstChild.nodeValue.replace(’.’, ‘’).replace(’ ', '’)) == 0)
{
var menu_cookie = c.split(’=’)
if (menu_cookie.length == 2 && menu_cookie[1] == ‘1’)
{
menu_header_click(elems*);
}
}
}
}
}
}
}
}[/COLOR]
And it also has this for the history thing.
[COLOR=Blue]function save_menu_status(menu_title, value, how_many_days)
{
var date = new Date();
date.setTime(date.getTime()+(how_many_days2460601000));
var expires = “”;
document.cookie = ‘xplike_menu_status_’ + menu_title.replace(’.’, ‘’).replace(’ ', '’) + ‘=’ + value + expires + ‘; path=/’;
}[/COLOR]
It might be easy and stupid, I know, but since I’m a designer - not a developer - all look weird to me!
Any thoughts?