Helpful Information
 
 
Category: vBulletin 5.x Modifications
Miscellaneous Hacks - Forum Collapse using JQuery

Make Forum item and forum list collapseable

Add new template --> name it as you want (in this i called forum_collapse--> and then put this code


<script type="text/javascript">
jQuery(document).ready(function () {
jQuery(".forum-list-container .forum-item").show();
jQuery("tr.subforum-list").show();
//toggle the componenet with class msg_body
jQuery("TR.category-header").click(function () {
jQuery(this).nextUntil(".forum-list-container .forum-item").fadeToggle(100);
jQuery(this).next("tr.subforum-list").fadeToggle(100);
jQuery(this).nextUntil("TR.category-header").fadeToggle(100);
});
});
</script>


and then...

edit template header...and find this line

<script type="text/javascript" src="{vb:raw jqueryurl}"></script>
<script type="text/javascript">window.jQuery || document.write('<script type="text/javascript" src="{vb:raw baseurl}/js/jquery/jquery-{vb:raw jqueryversion}.min.js"><\/script>');</script>


and then...add this line...after below line

<vb:if condition="$page['channelid'] == 1 OR $page['channelid'] == 1" />
{vb:template forum_collapse}
</vb:if>


also we can combine it.. with css to do some animation like folder tree

Best Regards

Godarmy

the jquery is now in footer template.

<vb:if condition="$page['channelid'] == 1 OR $page['channelid'] == 1" />

should not have closed tag at the end

<vb:if condition="$page['channelid'] == 1 OR $page['channelid'] == 1" >

it would be great is is using default vb5 collapse slide animation and collapse button

Can we have a possible demo or screenshot please?

Hi,

it works for me ( using vb 5 ) ....
and how can I make the sub forums in a state of collapse on the main page so that it does not require a lot of scrolling because of the many sub forums ?

thanks in advance

which header template? i didn't found that code in header template










privacy (GDPR)