Results 1 to 9 of 9

Thread: Animate Collpase DIV Problems clearing cookies.

  1. #1
    Join Date
    Jun 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Animate Collpase DIV Problems clearing cookies.

    1) Script Title: Animated Collapse DIV 2.4

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

    3) Describe problem: It appears that the cookie for this script is set whenever someone leaves the page which means to clear the cookies for this script a person has to navigate away from the page and THEN clear their cookies for the cookie to actually be deleted and to me this is not the behavior I would expect. What I did expect is to be able to clear my cookies while the page is still open and then refresh the page the cookie remain cleared much like it is when using these forums. Is there anyway to alter the script so that it behaves in this manner.

    Thanks,
    Nosix

  2. #2
    Join Date
    Aug 2004
    Posts
    9,878
    Thanks
    3
    Thanked 962 Times in 951 Posts
    Blog Entries
    15

    Default

    Hmm I'm not sure I completely understand. When you say "clear the cookies", do you mean manually deleting the cookie from the browser's toolbar? The cookie used in this script is session only, so its behavior is slightly different from that of say the forums, which is persistent.
    DD Admin

  3. #3
    Join Date
    Jun 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Sorry for any confusion and yes I mean manually deleting the cookie set by the script using the browser to delete the cookie and the reason the cookie is not session only is because I used your tip in this topic http://www.dynamicdrive.com/forums/s...ad.php?t=46272 to make it persistent. Currently I have it set to save for 365 days.

    That being said, the problem I am having is if I deleted the cookie (using my browser) and refreshed the page the divs do not revert to their original state (expanded in my case) because the cookie is being re-saved just before the page refreshes it seems and I would like to change this behavior so that if I delete the cookie and refresh the page then it will revert all my divs to their original state and only set the cookie again if any of the divs are altered in some way possibly using the Ontoggle event handler perhaps.

    I am admittedly new to Js so I am not sure this would even work but my idea is to comment out the this.setCookie() lines in the script and add them to the Ontoggle event
    function so that the cookie is only set after you change the state of a div but as I stated before this may not even be possible and my lack of Js experience doesn't help so I guess I just need to know if it's even possible to do what I need to do using the current script or not.

    Thanks again for your time,
    Nosix

  4. #4
    Join Date
    Jun 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Sorry for the bump but I really need to know if this is possible or not using the current version of this script because if it is not then I need to find another script that can do this.

    Thanks,
    Nosix

  5. #5
    Join Date
    Aug 2004
    Posts
    9,878
    Thanks
    3
    Thanked 962 Times in 951 Posts
    Blog Entries
    15

    Default

    Ok, try the below modified .js file. It should reset the persistence if cookies are explicitly cleared, or if you change the number of days to persist from the existing setting (ie: from 5 days to 3 days instead).

    Inside the .js file, the following line lets you set the number of days to persist:

    Code:
    persistdays: 5, //days to persist cookie
    June 29th Reuploaded animatedcollapse.js, which contained a slight syntax error that's now fixed.
    Last edited by ddadmin; 06-29-2010 at 06:50 PM.
    DD Admin

  6. #6
    Join Date
    Jun 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks but this does not seem to work. I deleted all of my cookies in firefox so I could make sure I was not mixing cookie names/values by mistake then I placed the new JS file you attached above in the directory where my old JS file was (I renamed the original file to animatedcollapse_original.jp just as a backup) and then I loaded my test page in the browser and these where my findings.

    1.) All my divs were collapsed by a default which is not how they were in the original version of the script because I setup a css file to explicitly have them open by default using display: block for divs however this new script seems to ignore that and so they are closed by default and not sure why.

    2.) If you delete your cookies while the page is still open the divs will not revert to their original states (as I said they would be closed in the new version of the script and open in the original version which is how I want them to be but that's another problem altogether I guess)

    Anyway I created a little test package that you can look at yourself to see whats going on. Included in the package is.

    • The original animatedcollapse.js file (renamed to animatedcollapse_original.js)
    • The new animatedcollapse.js file
    • Some custom expand / collapse icons I created for my site.
    • An index.html file (with explanations of the problem) that you can use to test the scripts.
    • A CSS file named style.css which I used to style the divs and to set the initial state of the divs to be expanded using display block. (ignored in new version of the script)


    Please take the time to look over my implantation of your script and let me know what I need to do to get it working as I would like.

    Thanks Again,
    Nosix

  7. #7
    Join Date
    Jun 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I hate to sound impatient but is there any update on this issue.

    Thanks again,
    Nosix

  8. #8
    Join Date
    Jun 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Just bumping this one last time to see if anyone can help me resolve this issue as it's been plaguing me for over a week now.

  9. #9
    Join Date
    Aug 2004
    Posts
    9,878
    Thanks
    3
    Thanked 962 Times in 951 Posts
    Blog Entries
    15

    Default

    Hmm that's strange. I looked over the modified animatedcollapse.js file again, which contained a slight syntax error (now fixed and file reuploaded). But the issue persists as far as deleting cookies not getting rid of the saved persistence setting. When I have time I'll come back to this to see if I can find the fault (in the next few days), though if this is a pressing issue, you may want to look at another script instead...
    DD Admin

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
  •