PDA

View Full Version : Switch Content script: Disable collapse of current element?



LCAngela
02-15-2008, 05:35 PM
1) Script Title: Switch Content

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

3) Describe problem:

I've used this script on several different sites with great success; however, there's one thing I find myself wishing for on my latest project: I'd like to disable the collapse of the current element.

For instance, if a user clicks on the link to expand Section1, I would like to remove the functionality that hides Section1 when they click the link again, limiting the script to only collapse that section when they click on another link for another section (with collapsePrevious set to "true").

Here's the mockup I'm currently working on, so hopefully you can get a better idea of what I'm after:
http://eq2gallery.com/bg/

I tried the code provided in this thread (http://www.dynamicdrive.com/forums/showthread.php?t=20198), but it's not quite what I'm looking for (besides that it doesn't tie in smoothly with the JS I'm using to change the appearance of the active "tab.")

Thanks in advance for any help or insight. :)

ddadmin
02-15-2008, 08:41 PM
Sure, try the below modified switchcontent.js file.

LCAngela
02-18-2008, 11:27 PM
Thanks! Works like a charm. :)

transistor
06-29-2008, 09:17 PM
Sure, try the below modified switchcontent.js file.

Can you tell me what you modified in that file so I can do the same to the ajax-updated file?

Thanks

ddadmin
06-30-2008, 10:14 PM
To make the same changes in the newer version of switchcontent.js with Ajax support, try finding the lines:


if (innercontent.style.display=="block")
this.contractcontent(header)

amd changing that to:


if (innercontent.style.display=="block"){
if (!this.collapsePrev || this.collapsePrev && this.prevHeader.id!=header.id)
this.contractcontent(header)
}

That should do it. FYI an excellent program to easily compare changes between two files is Beyond Compare (http://www.scootersoftware.com/). I use it all the time.