MyBB Community Forums

Full Version: Toggle Subforums In ...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I was wondering how I would get these to toggle open when clicked? Its the 'forumdisplay_subforums' area that I'm talking about.


I tried wrapping them in a toggling script but it does not work, would anyone have any ideas of what other templates I would need to edit to make this work?

<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead" colspan="5"><a href="#subs" onclick="toggle_visibility('subs');">{$lang->sub_forums_in}</a><br /><span class="smalltext">- click to toggle -</span></td>
</tr>
	<div id="subs" style="display: none !important;">{$forums}</div>
</table>
<br />


<script type="text/javascript">
<!--
    function toggle_visibility(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
          e.style.display = 'block';
    }
//-->
</script>
Just a friendly little bump.
Try:
onClick="jQuery(this).parent().siblings('tr').eq(0).hide();jQuery(this).hide();
(unable to test do it's kind of a shot in the dark)

If that doesn't work I'll try give you a solution tomorrow it nobody else has.
check if this works, incase nth's method doesn't...


<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead button" colspan="5">{$lang->sub_forums_in}<br /><span class="smalltext">- click to toggle -</span></td>
</tr>
    <table width=100% id="subs" class="subf">{$forums}</table>
</table>
<br />


<script>
$(document).ready(function(){
    $(".button").click(function(){
        $(".subf").toggle();
    });
});
</script>
Thank you both, mmadhankumar's option worked wonderously! Smile Much appreciated!!