PDA

View Full Version : collapse the accordion menu when jumping to another page



kwik03
05-13-2010, 05:50 AM
1) Script Title: dd accordion (1.7)

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

3) Describe problem: I am wondering if it's possible to edit the code so that a menu collapses entirely when being clicked... or if possible, basically reloads the javascript so that the section isn't expanded when going to the next url.

If this is not clear, please see the example here: http://www.kikwon.com/ssllc_test/ I would like the home and contact menu to collapse the entire menu when clicking from other pages.

Your help would me most greatfully appreciated.

azoomer
05-13-2010, 09:52 AM
Looking at your page it seems like there is some cookie keeping the submenu open. You could probably find it in the accordion script but I don't know how to mess with that. I tried pasting this:

<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('.submenu').css('display','none');
});
</script>

in the code just before the </head> tag. On my computer it seems to work but i'm not sure. You could give it a try.

kwik03
05-13-2010, 03:31 PM
thank you so much azoomer!
it works great!
You are awesome. Thanks again!

kwik03
05-13-2010, 10:48 PM
I think i spoke too soon. While this solves the collapsing of the menu which is great...the expand/collapse image (in this case arrows instead of + -) does not seem to refresh. Would there be a fix to this with a simple javascript addition? Thanks again for the assistance. It's greatly appreciated.

azoomer
05-14-2010, 01:48 AM
Maybe i was to hasty with the above code. I guess the solution may already be in the documentation for the script : http://www.dynamicdrive.com/dynamicindex17/ddaccordion.htm

Not sure but you can try to change the persiststate to false and see what that does. Or maybe we could get advice from someone with more understanding of the script