PDA

View Full Version : Accordion Menu script (v1.3) headers not expanding correctly



catchgraphics
05-24-2008, 04:58 AM
1) Script Title: Accordion Menu script (v1.3)

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

3) Describe problem:
Accordion Menu script (v1.3) isn't expanding the correct header when a subheading link is chosen. I have worked out that it works great when all the pages (files) are in the same folder but as the site I have built has many folders to organise all the different sections of the website this seems to stop the expanding of the headers working correctly.

If I have a submenu page open and I click on another submenu selection (under a different header) the previous header is expanded instead of the correct header. The correct page is displayed though.

Anyone know how to make the script work when there are pages stored in different folders?

ddadmin
05-24-2008, 05:51 AM
I think you're talking about the persistence feature not persisting the correct header when going from one folder on your site to the next right? If so, this is simply due to the fact that the cookie feature in the script is localized to each folder. You can change it to site wide by making the changes in red to the below inside ddaccordion.js:


setCookie:function(name, value){
document.cookie = name + "=" + value+"; path=/"
},

catchgraphics
05-24-2008, 06:29 AM
Thanks a million! I have only trialled the script changes in a couple of browsers so far but that was exactly what I wanted!

I really appreciate that I have been trying to solve that for days so it is such a relief to have that working now.

Again many thanks!

Michael

catchgraphics
05-24-2008, 11:41 AM
Hi, thanks again for your help. I have finished all my testing in browsers and found the accordion menu with that new tweak makes the navigation work great in all browsers except one ie6. In IE6 the headers are closing up instead of expanding (as they do in all the other browsers). Is there any way to get ie6 to work properly?

Many thanks for any help you give.

ddadmin
05-24-2008, 06:38 PM
Hmmm does your page contain a valid doctype (http://www.javascriptkit.com/howto/doctype.shtml) at the very top? If so, please post a link to the problem page.

catchgraphics
05-24-2008, 08:37 PM
I think it is valid. I have been working on the site locally but have uploaded the test site for you to look at: http://www.catchgraphics.com/futrix/products/custperformancetools.php

Again many thanks for all your help – it is just fantastic.

ddadmin
05-24-2008, 09:03 PM
Try removing the code:


<script type="text/javascript">
//Start Tab Content script for UL with id="maintab" Separate multiple ids each with a comma.
initializetabcontent("maintab")

var param=window.location.href.match(/selectedtab=(\d+)/i)
if (RegExp.$1!="")
expandtab('maintab', RegExp.$1)
</script>

It's generating a script error, which in the case of IE, usually throws off the other scripts on the same page as well. It doesn't look like you're actually using Tab Content script on your page.

BTW, please note that your page is currently in violation of our usage terms, since the credit notice doesn't appear inline on the page. Please reinstate the credit notice: http://www.dynamicdrive.com/notice.htm

catchgraphics
05-24-2008, 09:16 PM
Thanks for that. I will fix that and let you know how I get on.
Cheers

catchgraphics
05-25-2008, 09:51 AM
Hi I have made those changes but IE6 is still not expanding the headers. Do you have any other suggestions?
Many thanks

ddadmin
05-25-2008, 04:18 PM
Ok, upon some testing, it seems IE6 isn't setting the cookie for some reason. I'll have to get back to this later next week and post the fix then (if not, just remind me :) ).

catchgraphics
05-28-2008, 09:55 PM
Hi just a reminder to see if you have time to see if you can work out why the dreaded ie6 doesn't leave a cookie for the above site.
many thanks

catchgraphics
05-29-2008, 02:01 AM
Hi I have checked the accordion menu on IE6 where IE6 is the only version of IE on the computer (Not a stand alone version as I had previously used). the script works fine on that. I think that the javascript wasn't working properly on the standalone version of IE6 only (which I have been told is known to not work perfectly with javascript). As only web developers use the stand alone versions I won't worry about that issue.
So I think it is all resolved.
Thanks again for the help you have given me.

Kind regards,

Michael