Add Hide/Show Collapsable Category Button on Title Bar
May 23, 2016 17:34:10 GMT -8
aRMY83, Tumbleweed, and 3 more like this
Post by john1960 on May 23, 2016 17:34:10 GMT -8
This code puts a Hide/Show button on your Category Title bar that when clicked will make the Category threads/posts disappear. When re-clicked the category threads/posts will re-appear. Really good to use when the forum is long and has lots' of categories and you don't use some of them.
Put this in the Main Footer:
Now to make the buttons line up properly one has to set the
to match their forums width. If your forum is 1200px wide then set the code at the same width.
Preview: theridetest.freeforums.net/
Now for those who use the plugin called V4 News Fader you will need to use the following code that keeps the Hide/Show button from appearing on the News Fader title bar, in fact if you didn't want the Hide/Show button on your top category title bar you would still use this code and again put it in the
Main Footer
Again the same thing applies here as far as width settings.
Preview: itistheride.boards.net/
Put this in the Main Footer:
<script>
jQuery(function($){
var info = {};
$(".title-bar").each(function(i, v){
var $c = $(".content", $(v).parent()), ts = "title-bar" + i,
$ae = ($ae = $('h2 .title_wrapper', v)).length? $ae : $('h2', v);
if(window.localStorage[ts] && window.localStorage[ts] === "true"){
$c.hide();
info[ts] = true;
}
i && $ae.css({maxWidth: 880});
$ae.append('<span style="float: right; cursor: pointer;">Hide/Show</span>').
click(function(){
$c.animate({ height:"toggle" }, 1000, "easeOutQuad");
if(info[ts]){
info[ts] = false;
window.localStorage[ts] = "false";
} else {
window.localStorage[ts] = "true";
info[ts] = true;
}
});
});
});
</script>
Now to make the buttons line up properly one has to set the
i && $ae.css({maxWidth: 880});
to match their forums width. If your forum is 1200px wide then set the code at the same width.
Preview: theridetest.freeforums.net/
Now for those who use the plugin called V4 News Fader you will need to use the following code that keeps the Hide/Show button from appearing on the News Fader title bar, in fact if you didn't want the Hide/Show button on your top category title bar you would still use this code and again put it in the
Main Footer
<script>
jQuery(function($){
var info = {};
$(".title-bar").each(function(i, v){
if(!i){return true;}
var $c = $(".content", $(v).parent()), ts = "title-bar" + i,
$ae = ($ae = $('h2 .title_wrapper', v)).length? $ae : $('h2', v);
if(window.localStorage[ts] && window.localStorage[ts] === "true"){
$c.hide();
info[ts] = true;
}
$ae.css({maxWidth: 880}).append('<span style="float: right; cursor: pointer;">Hide/Show</span>').
click(function(){
$c.animate({ height:"toggle" }, 1000, "easeOutQuad");
if(info[ts]){
info[ts] = false;
window.localStorage[ts] = "false";
} else {
window.localStorage[ts] = "true";
info[ts] = true;
}
});
});
});
</script>
Again the same thing applies here as far as width settings.
Preview: itistheride.boards.net/