Results 1 to 3 of 3

Thread: Can onopenclose() cause a main content area to disappear/appear?

  1. #1
    Join Date
    Feb 2009
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Smile Can onopenclose() cause a main content area to disappear/appear?

    1) Accordion Content script (v1.6)

    2) http://dynamicdrive.com/dynamicindex17/ddaccordion.htm

    3) Describe problem:

    I would like the action of a user opening a header up to change which <div> is displayed in the main content area. The idea is that when the page loads, all accordiaons are closed and the main text displays a separate paragraph (ie a separate <div> section) relevent to each header. When a header is clicked to open it, only its its relevent paragraph remains displayed in the maintext area. The accordion's links then act as normal.
    Last edited by ddadmin; 03-17-2009 at 04:45 AM.

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

    Default

    Certainly. What you put inside onopenclose() is not limited to just code that affects the menu itself, and outside of it as well.

    In your case, try giving each header a unique ID, such as "header1", then for the corresponding paragraph, a ID based on the former so the two can easily be linked together, such as "para-header1". Then inside your onopenclose() event, do something like:

    Code:
    onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
    	var paraid="para" + header.id
    	document.getElementById(paraid).style.display=(state=="block")? "block" : "none"
    }
    What the above does is expand or hide paragraph "para-headerx" based on the corresponding header's own state.
    DD Admin

  3. #3
    Join Date
    Feb 2009
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Thumbs up Thanks for the information, works very well now!

    Made the changes as you suggested and it all works well, doing exactly what I needed. Until the client asks for yet another "small change.......".
    Thanks again for a great facility, made brilliant by your quick and helpful answers.

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
  •