View Full Version : "Collapsing Divs"
Wow. I feel like I'm 'using' this forum. Sorry D:
Anyways, yes I've googled it, but there wasn't a 100% clear answer.
At the moment, I have a script (javascript I think) where you click a link, and it toggles a div to either retract or collapse.
However, refresh the page, or click a link, and they reset. So, is there a way to save the state of the div(s) to a cookie?
Thanks
Luke
MattFr
08-05-2010, 07:44 PM
Wow. I feel like I'm 'using' this forum. Sorry D:
Anyways, yes I've googled it, but there wasn't a 100% clear answer.
At the moment, I have a script (javascript I think) where you click a link, and it toggles a div to either retract or collapse.
However, refresh the page, or click a link, and they reset. So, is there a way to save the state of the div(s) to a cookie?
Thanks
Luke
I can't give you code because I don't know how you have it coded, but basically, when you call the function to change the state of the div, write to a cookie. Then when loading, use some conditionals to set the default state of the div. Pretty easy :)
Haven't a clue how to write a cookie like that haha :L
http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm I'm using that if it helps
<a href="javascript:animatedcollapse.toggle('sub1')" class="title">
Link
<script type="text/javascript" src="js/animatedcollapse.js"></script>
<script type="text/javascript">
animatedcollapse.addDiv('sub1', 'fade=0,speed=400')
animatedcollapse.addDiv('sub2', 'fade=0,speed=400')
animatedcollapse.addDiv('sub3', 'fade=0,speed=400')
animatedcollapse.ontoggle=function($, divobj, state){
}
animatedcollapse.init()
</script>
In the head section
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.