Quote:
Originally Posted by ravyn
Sometimes I will collapse boxes and as I return to the forum home page, they will remain collapsed, but the side menu boxes don't remember. They will either be open or closed depending on whether I have added the display:none thing in the style variable, but not dependant on whether I have opened or closed them before. Is there a reason for this?
|
There's 2 tricks to remember the state of a collapsed element.
1 - Using unique variables and the tricks involved in naming them.
2 - Some places require you to reference the GLOBAL to get the collapsed state from the cookie.
To do something like collapse a post.
Button:
Code:
<a href="#top" style="float:$stylevar[right]"
onclick="return toggle_collapse('post_$post[postid]')">
<img id="collapseimg_post_$post[postid]"
src="$stylevar[imgdir_button]/collapse_thead{$GLOBALS['vbcollapse']['collapseimg_post_'.$post[postid]]}.gif"
alt="Collapse/Expand" border="0" /></a>
Table:
Code:
<table width="100%" align="right" border="0" cellpadding="0" cellspacing="0">
<tbody id="collapseobj_post_$post[postid]"
style="{$GLOBALS['vbcollapse']['collapseobj_post_'.$post['postid']]}">
Stuff to hide.
</tbody>
</table>
Without using $GLOBALS['vbcollapse'], it won't get the information from the cookie.