Revolution X

Coding Community => Coding Snippets => Topic started by: Vitality on November 12, 2008, 09:25:00 pm



Title: Toggle Category Headers
Post by: Vitality on November 12, 2008, 09:25:00 pm
It does what the title says. If you click on the header of a category, it will collapse, and if you click it again, it will expand. I don't know how many browsers it will work in, I know it works in FF though. It's just something I whipped up very, very quickly.
Code:
<script>
/*Toggle Category Headers By Vitality of TCZ || Revolution X*/
$(".catbg").click(function (){$(this).next().toggle();});
</script>


Title: Re: Toggle Category Headers
Post by: Spoken on November 12, 2008, 09:55:49 pm
The only problwm with this code is, when you click on the category name, it toggles it, then refreshes the page. Because the URL that is linked to the category name is the site home.


Title: Re: Toggle Category Headers
Post by: Spoken on November 12, 2008, 10:01:28 pm
Nevermind. If you just click the catbg image it toggles it XD


Title: Re: Toggle Category Headers
Post by: Mojobojo82 on June 22, 2009, 04:13:11 am
Spoken, That doesn't happen with me.
It works fine on my Forum