Remembered Collapsible Objects with PHP and Javascript
Friday, August 26th, 2005This is kind of a part two to my quite popular (well, popular according to the search engines) post Collapsible Tables with Javascript.
This time I went through and extended the features a little. With this script, your users won’t have to keep clicking to collapse/uncollapse objects on your pages. Through Javascript setting cookies, and PHP picking up on the cookies, your page will “remember” the state each object should be in. Thus, the things the user has chosen to collapse will stay collapsed and the things they chose to uncollapse will stay uncollapsed.
I also wanted to bring attention to newer users: almost anything can be collapsed. My last post used “table” in the title and many new users seem to think only table rows / tbody’s can be collapsed. But, of course, that is not the case. Collapsing is simply hiding, so anything that can be hidden can effectively be collapsed. This means: tables, lists, buttons, forms, divs, fieldsets etc. (more…)