PDA

View Full Version : SwitchContent issues



lydas2000
02-24-2009, 05:47 PM
1) Script Title: Switch Content Script

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

3) Describe problem: The persistent menu doesn't stay expanded. When the page switches, another menu will be expanded, but this only happens on the live site (http://www.birdsongcreative.com/work.html) and not when testing locally. :confused:

ddadmin
02-24-2009, 11:14 PM
Try making the persistence feature side wide, instead of just directory wide. Inside the .js file, replace the original switchcontent.setCookie() function with the below instead:


switchcontent.setCookie=function(name, value, days){
if (typeof days!="undefined"){ //if set persistent cookie
var expireDate = new Date()
var expstring=expireDate.setDate(expireDate.getDate()+days)
document.cookie = name+"="+value+"; path=/; expires="+expireDate.toGMTString()
}
else //else if this is a session only cookie
document.cookie = name+"="+value+";path=/"
}

lydas2000
02-25-2009, 03:17 PM
Thanks but that didn't do it.

That seemed to choose one to keep expanded on every page no matter what I expanded previously.

When I set the code back the original then it went back to working locally like it should, but still chooses random menus to expand on the live site.

I thought it may have been a LoadRunTime issue with the open and close icons when I was using GIFs for those. I have since changed them to text icons and it made no difference.

I would like to get this figured out since this script theoretically does what I need. If not I have to change my whole approach. Are there other scripts that do essentially the same thing?

ddadmin
02-26-2009, 12:29 AM
When I set the code back the original then it went back to working locally like it should, but still chooses random menus to expand on the live site.

Can you give a step by step example of this, ie, which menu links to click on etc. As mentioned, for me, the persistence feature does seem to work correctly in FF3.x for me, with the exception when the target page is in a different directory than the current page. Due to the default local persistence setup, the persistence does not transfer from page A to page B.

lydas2000
02-26-2009, 04:36 PM
After reading your reply, it occurred to me to try to have all of the pages in the same directory and presto...it works great!

I prefer to organize the pages in directories by category but this is working so it's cool.

Thanks for your responses!

ddadmin
02-26-2009, 08:25 PM
If the problem in fact is due to your pages being in different directories, the mod to the cookie code I posted above should have fixed the issue, so the behavior of the menu is the same as if they were all in the same directory. Just fyi. :)