Results 1 to 3 of 3

Thread: Animated Collapse - function to hide all + one other thing...

  1. #1
    Join Date
    Sep 2009
    Posts
    9
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Animated Collapse - function to hide all + one other thing...

    1) Script Title: Animated Collapsible DIV v2.4

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...edcollapse.htm

    3) Describe problem:

    Hi. So far I have had great success with this script - thank you so much! However I am wondering if there is a function to collapse all the open divs? Here is my dilemma:

    I have an accordion navigation (the regular jQuery accordion) with four main areas. Each houses a list of several sub-areas. When each of these sub areas is clicked, I am using the animated collapse script to show a navigation layer with more options. So far, no problem. However I would like to have it so that when the user clicks on one of the top tier choices, ALL open divs close. Normally I can understand how this is easy to do, however I have two layer/div groups and a background div layer that is always expanded on a sub-nav click. Is it possible to close all initiated divs?

    And the other question relates to passing a css class to the sub-nav text when I click on it to show a div. This would be to change its color/bold, etc. so that the choice appears like the activated one when the user initiates the div. Any help would be greatly appreciated!

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

    Default

    To hide all animated collapsible contents on the page, you can use the following function:

    Code:
    <script type="text/javascript">
    
    function collapseall(){
    	jQuery.each(animatedcollapse.divholders, function(i, val){
    		animatedcollapse.hide(val.id)
    	})
    }
    
    </script>
    For example:

    Code:
    <a href="javascript:collapseall()">Hide all contents</a>
    Regarding how to modify the style of the anchor link that toggles a content, see the solution mentioned in this thread.
    DD Admin

  3. #3
    Join Date
    Sep 2009
    Posts
    9
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    Thank you thank you! I'll give it a shot. Looks like it is exactly what's needed!

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
  •