dariuss
07-06-2009, 03:00 PM
Hi,
I have placed on my website accordion script for the menu. But i have one small problem with it. When I come to the website it opens normally. But when I try to get to one page (one from the menu) - after click, accordion changes to appropriate menu. But twice. The script reloads the menu also immediately after click and also after the page reloads to new page (to where I am going).
So i mean that it will be better for users, if the accordion should reload only after the new page reloads. I have to add this code :
$('home_link').addEvent('click', function(event){
window.location = "http://home...";
});
$('page1_link').addEvent('click', function(event){
window.location = "/page1";
});
if (window.location.href.test("/page1/")) {
accordion.display(1);
};
$('page2_link').addEvent('click', function(event){
window.location = "/page2";
});
if (window.location.href.test("/page2/")) {
accordion.display(2);
};
$('page3_link').addEvent('click', function(event){
window.location = "/page3";
});
if (window.location.href.test("/page3/")) {
accordion.display(3);
};
So i mean that the use of this verifying code causes my issue. But the code is "nessesary" because without it, after reloading the new page, accordions displays only home menu, not the menu in which I am.
The accordion main code is:
var list1 = $$('#accordion h3');
list1.each(function(element) {
element.addEvent('mouseclick', function(){
switch(element.className){
case"toggler atStart t1": index=0; break;
case"toggler atStart t2": index=1; break;
case"toggler atStart t3": index=2; break;
case"toggler atStart t4": index=3; break;
}
accordion.display(index);
});
});
I would be very grateful if someone could help me with this.
Thanks
dariuss
I have placed on my website accordion script for the menu. But i have one small problem with it. When I come to the website it opens normally. But when I try to get to one page (one from the menu) - after click, accordion changes to appropriate menu. But twice. The script reloads the menu also immediately after click and also after the page reloads to new page (to where I am going).
So i mean that it will be better for users, if the accordion should reload only after the new page reloads. I have to add this code :
$('home_link').addEvent('click', function(event){
window.location = "http://home...";
});
$('page1_link').addEvent('click', function(event){
window.location = "/page1";
});
if (window.location.href.test("/page1/")) {
accordion.display(1);
};
$('page2_link').addEvent('click', function(event){
window.location = "/page2";
});
if (window.location.href.test("/page2/")) {
accordion.display(2);
};
$('page3_link').addEvent('click', function(event){
window.location = "/page3";
});
if (window.location.href.test("/page3/")) {
accordion.display(3);
};
So i mean that the use of this verifying code causes my issue. But the code is "nessesary" because without it, after reloading the new page, accordions displays only home menu, not the menu in which I am.
The accordion main code is:
var list1 = $$('#accordion h3');
list1.each(function(element) {
element.addEvent('mouseclick', function(){
switch(element.className){
case"toggler atStart t1": index=0; break;
case"toggler atStart t2": index=1; break;
case"toggler atStart t3": index=2; break;
case"toggler atStart t4": index=3; break;
}
accordion.display(index);
});
});
I would be very grateful if someone could help me with this.
Thanks
dariuss