Results 1 to 6 of 6

Thread: Animated Collapsing Div's

  1. #1
    Join Date
    Apr 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Animated Collapsing Div's

    1) Script Title:
    Animated Collapsing Div's

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

    3) Describe problem:
    Hi, first of all thanks for this script. Its awesome, so sweet being able to watch your content slide away so tidily!

    So heres the problem, the script saves each page as a seperate unique id, so if I have the same boxes showing on different pages, such as a login which appears in every page. It doesnt remember it for all pages displaying the login.

    Is there anyway to change this script so that it remembers this? I only going to use it for the single login section, just so if people want to hide it they can but I want it to remember for each page in the site as a whole, and not as seperate pages, how do I do that?

    Thanks for any help in advance.

    Marshall.

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

    Default

    Try changing the below two lines in the .js file, by removing the parts in red:

    Code:
    this.isExpanded=animatedcollapse.getCookie(uniquepageid+"-"+divId) //"yes" or "no", based on cookie value
    Code:
    animatedcollapse.dotask(window, function(){animatedcollapse.setCookie(uniquepageid+"-"+thisobj.divId, thisobj.isExpanded)}, "unload")
    Then, modify the below line near the bottom, by adding to it the part in red:

    Code:
    document.cookie = name+"="+value+';path=/'
    That should do it.

  3. #3
    Join Date
    Apr 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi, I made those changes just inside the default script and created an identical page with the same div, but it doesnt store, it still collapses (as default)...

    I have tried this on a live server and not from my computer of course.

    Any ideas?

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

    Default

    Sorry to be a pain, but also, is there anyway to make it store for longer than the current session? For example, 7 days after (so long as cookies arent reset)?

    If this is possible without too much hassle it would be perfect for my forum (when I have time to do it!)

    Thanks again.

    Marshall.

  5. #5
    Join Date
    Apr 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It does work today, sorry, it must have been running for cache or something, it seems to work fine today with storing it as a single reference and not each page as unique. Great!

    Is there anyway to store it for any longer than the current session?


    Also: I cant get it to start opened, I have added the "block" as the last reference in the javascript but it doesnt seem to do anything. They all start closed unless I set the options to false, "block", but then it doesnt store whether they are open or closed...

    Any help?

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

    Default

    Regarding issue #1 above, please post a link to the page on your site that contains the problematic script so we can check it out. For #2, you can make the cookie persistent and for x number of days by making the changes in red to the line "document.cookie=..." above:

    Code:
    var expireDate = new Date()
    expireDate.setDate(expireDate.getDate()+3)
    document.cookie = name+"="+value+";path=/"+";expires="+expireDate.toGMTString()
    Where 3 means 3 days.

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
  •