Results 1 to 5 of 5

Thread: Switch Content script: Disable collapse of current element?

  1. #1
    Join Date
    Feb 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Switch Content script: Disable collapse of current element?

    1) Script Title: Switch Content

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...tchcontent.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, 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.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,140
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Sure, try the below modified switchcontent.js file.

  3. #3
    Join Date
    Feb 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks! Works like a charm.

  4. #4
    Join Date
    Jan 2008
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by ddadmin View Post
    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

  5. #5
    Join Date
    Aug 2004
    Posts
    10,140
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    To make the same changes in the newer version of switchcontent.js with Ajax support, try finding the lines:

    Code:
    	if (innercontent.style.display=="block")
    		this.contractcontent(header)
    amd changing that to:

    Code:
    	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. I use it all the time.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •