Results 1 to 3 of 3

Thread: Animated collapsible div v2.4 - cookies?

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

    Default Animated collapsible div v2.4 - cookies?

    1) Script Title: Animated collapsible div v2.4

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

    3) Describe problem: It's not really a problem, I guess... I'm using this great script to toggle the display of a search module. The div is collapsed on page load.
    However, when displaying the div and using the search module on my page, the page reloads which obviously causes the div to collapse. I would really like it to stay open/displayed until it's manually closed.

    So I'm thinking, would it be possible to make it add a cookie in order to remember it's current state?
    Last edited by meek; 09-20-2010 at 12:41 PM.

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

    Default

    Have you tried enabling persistence when initializing your DIVs via persist=1, such as:

    Code:
    <script type="text/javascript">
    
    animatedcollapse.addDiv('jason', 'fade=1,height=80px,persist=1')
    animatedcollapse.addDiv('kelly', 'fade=1,height=100px,persist=1')
    animatedcollapse.addDiv('michael', 'fade=1,height=120px,persist=1')
    
    animatedcollapse.addDiv('cat', 'fade=0,speed=400,group=pets')
    animatedcollapse.addDiv('dog', 'fade=0,speed=400,group=pets,persist=1,hide=1')
    animatedcollapse.addDiv('rabbit', 'fade=0,speed=400,group=pets,hide=1')
    
    animatedcollapse.ontoggle=function($, divobj, state){ //fires each time a DIV is expanded/contracted
    	//$: Access to jQuery
    	//divobj: DOM reference to DIV being expanded/ collapsed. Use "divobj.id" to get its ID
    	//state: "block" or "none", depending on state
    }
    
    animatedcollapse.init()
    
    </script>
    DD Admin

  3. The Following User Says Thank You to ddadmin For This Useful Post:

    meek (09-20-2010)

  4. #3
    Join Date
    Jun 2009
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Hi, and thanks for the reply.
    That's exactly what I was looking for. I can't believe I missed that attribute in the first place. It works perfectly.

    Thanks again.

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
  •