PDA

View Full Version : Accordion menu - changing menu staus from different menu



mikekist
03-28-2008, 04:20 AM
1) Script Title: ddaccordion.js

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu.htm

3) Describe problem: I'm using the accordion menu and it's working very well. I have 2 menus on the same content page (left and top) and the left menu is set up using the accordion script. I would like to be able to click on the top menu and collapse/expand the portions of the left menu that correspond. I can use the collapseall function to collapse but when trying to use the expandone function I just can't figure what goes in the 'selected' variable. This was my approach and if there is a better way, I would appreciate some help.

Thanks,
Mike

http://exeedra.kistenterprises.com/exeedra.htm

mikekist
03-29-2008, 09:49 AM
I can't believe that no one here knows anything about the functions contained in ddaccordion.js. There has to be a very simple solution for using these functions (expandone, collapseone, toggleone, etc). You only have to pass the "headername" and "selected" to the functions as parameters. The headername is no problem but everything I try to pass as selected doesn't seem to work.

I did write a new function to make things work but when I use the top menu and then return to the left menu the submenu will not collapse when choosing another menu item. I think it would be a lot easier to just use the ddaccordion.js functions if I only could make sense of the script.

ddadmin
03-30-2008, 08:05 AM
I'm actually more confused on the question itself. Try to cut out everything but the exact area you have trouble doing. All I got so far is that you're asking about the "index" parameter of say:


ddaccordion.expandone('header_class', index)

But what about it?

mikekist
03-31-2008, 04:43 PM
First I would like to really thank you for answering my post.

The accordion script has the word "selected" where you have put "index" and I was confused as to what parameter was supposed to be passed to that variable.

However this approach still doesn't seem to be working for me so here is my situation:

I have a left vertical menu operating with the accordion.js script to fill a content area via httpXMLRequest calls. This part seems to be working great.
Now I also have a top horizontal menu that I would like when clicked to open and close the left menu's submenu blocks as if it was getting the click directly. I thought by using toggleone, expandone or collapseone that this would do the trick but there seems to possibly be a conflict between the two indexes from the two menus (the top menu does not have "expandable" class).

Code using onclick:
set_cookie(name, value);
switch (value)
{
case '0c':
ddaccordion.toggleone('expandable', '0', 'expand');
loadXMLDoc('about/exoverview.txt');
break;
case '1c':
ddaccordion.toggleone('expandable', '1', 'expand');
loadXMLDoc('services/itservices/itoverview.txt');
break;
etc.
It seems the "about" and "help" menu items are working but the rest are opening then closing the menus immediately instead of leaving the selected one open.

You can see the problem at: http://exeedra.kistenterprises.com/exeedra.htm

I'm not sure where to start to get this to function as desired.

I hope this is clear and if you could provide any help at all I would be greatly appreciative.

Thanks again,

Mike

ddadmin
04-01-2008, 07:49 PM
Now I also have a top horizontal menu that I would like when clicked to open and close the left menu's submenu blocks as if it was getting the click directly.

If I understand what you're trying to accomplish correctly, you'll want to check back in a couple of days. I'm updating Accordion Content script right now precisely to make it easy to expand certain headers on the target page via remote links with a query string added to them (ie: target.htm?mypets=1,2). I'm also extending the script with two custom event handlers that let you run your own custom code whenever a header is expanded/contracted.

mikekist
04-02-2008, 06:35 AM
Thanks for getting back to me so quickly. I am anxiously waiting for your new scripts and can use them to replace the cookies I am now using for remote links.

However, the content page does not change (refresh) (exeedra.htm) with only the text file content changing via AJAX calls - so the remote links aren't necessary but I guess I will be able to write some custom code to serve the purpose. Just thought that the accordion script would work better.

Thanks again for your help,

Mike