I use a javascript code on my forum to hide/collapse a category that works well and here is the forum:
http://thescooterprofessor.proboards.com/
If you scroll down and look at the Forum Information and Statistics category you'll see on the right the words Hide/Show. When clicked on the whole category collapses and just the title bar is left showing. Click on it again and the information re-appears. Here is the code:
Code:
<script type="text/javascript">
$(document).ready(function(){
var info = false;
if(window.localStorage["center-close"] && window.localStorage["center-close"] == "true"){
$(".stats .content").hide();
var info = true;
}
$(".stats .title-bar").click(function(){
$(".stats .content").animate({ height:"toggle" }, 1000, "easeOutQuad");
if(info){
info = false;
window.localStorage["center-close"] = "false";
} else {
window.localStorage["center-close"] = "true";
info = true;
}
});
});
</script>
This code is put in what is called the Main Footer of the forum. To get the words Hide/Show to go into the title bar one goes to the Home Template section and places the following line of code in the Statistics Title Bar section of the template coding. Here is that section:
Code:
{if $[show_stats]}
<div class="container stats">
<div class="title-bar"><h2>Forum Information & Statistics<span style="float: right;">Hide/Show</span></h2></div>
<div class="content">
Now here is the Home template code and if I'm correct this section controls the Legend title bar and information section and also what would be the other categories that one would name when building the forum, here is the Home Template code that also includes the above mentioned Statistics title bar too:
Code:
{foreach $[category]}
$[category.anchor]
<div class="container boards">
<div class="title-bar bbcode"><h2><div class="title_wrapper">$[category.display_name]</div></h2></div>
<div class="content cap-bottom">
$[category.board_list]
</div>
</div>
{/foreach}
{if $[legend]}
<div class="container legend home">
<div class="title-bar"><h2><div class="title_wrapper">Legend</div></h2><div id="messages_container"></div></div>
<div class="content">
<table>
<tr>
{foreach $[legend]}
<td>$[legend.icon] <span>$[legend.name]</span></td>
{/foreach}
</tr>
</table>
<center><a href="http://info.flagcounter.com/a7SY"><img src="http://s09.flagcounter.com/count_US/a7SY/bg_e3e3e3/txt_000000/border_CCCCCC/columns_8/maxflags_50/viewers_Students+and+Visitors/labels_1/pageviews_1/flags_0/" alt="Flag Counter" border="0"></a></center>
</div>
</div>
{/if}
{if $[show_stats]}
<div class="container stats">
<div class="title-bar"><h2>Forum Information & Statistics<span style="float: right;">Hide/Show</span></h2></div>
<div class="content">
As I mentioned you can see the Legend and Statistics title bar coding and my thinking is the [category.display_name] is the section that covers all of the other title bars in the forum. I've tried this and that to make the javascript code work for the other two to no avail. Can someone help me with this and what would be nice is a code that would cover the whole forum for each title bar. I've seen this work at other places.
Thanks
Bookmarks