Hello to all,
I have a little problem with my accordion menu and I CRAVE for your help!
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.
Here is the js code:
function add_menu_event_handlers()
{
var elems = document.getElementsByTagName(‘h3’);
for (i = 0; i < elems.length; i++)
{
switch (elems[i].parentNode.className)
{
/*case ‘moduletable’:
case ‘moduletable_menu’:
case ‘left_module_title’:
case ‘left_module_title_menu’:
{
if (elems[i].parentNode.parentNode.parentNode.id == ‘xp-left’)
{
xplike_addEvent(elems[i], ‘click’, function(){menu_header_click(this);});
// menu_header_click(elems[i]);
//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[i].firstChild.nodeValue.replace(‘.’, ‘
{
var menu_cookie = c.split(‘=’)
if (menu_cookie.length == 2 && menu_cookie[1] == ‘1’)
{
menu_header_click(elems[i]);
}
}
}
}
}
}
}
}
And it also has this for the history thing.
function save_menu_status(menu_title, value, how_many_days)
{
var date = new Date();
date.setTime(date.getTime()+(how_many_days*24*6 0
var expires = “”;
document.cookie = ‘xplike_menu_status_‘ + menu_title.replace(‘.’, ‘
}
It might be easy and stupid, I know, but since I’m a designer – not a developer – all look weird to me!
Any thoughts?