Welcome Guest [Log In] [Register]
This board has been archived and is no longer accepting new questions. If you have a support question for your ZetaBoard, please visit us at the new support board. Registration is free and easy.


Visit the NEW ZetaBoards Support forum!

Username:   Password:
Add Reply
Category Image
Topic Started: Mar 17 2008, 02:59 PM (2,944 Views)
rockon1824
Member Avatar
Member
[ *  * ]
This code places an image between the category h2 and the forums. (Preview)

3/19/08: Fixed it so that the image will go away when the category is collapsed.

Put this in Below the Board or Above the Copyright in your Board Template:
Quote:
 
<script type="text/javascript">
//<![CDATA[
$(".cat_head:contains('CATEGORY NAME')").next().prepend('<tr><td colspan=\"5\" class=\"c\"><img src=\"IMAGE URL\" alt=\"ALT TEXT\"></td></tr>');
//]]>
</script>

Change the red text to the name of the category where you want to add the image (i.e. News & Discussion).
Change the blue text to the URL of the image you want to use.
Change the green text to the text you want to appear in case the image doesn't load.


To add a different image for more than one category, just do something like this:
Quote:
 
<script type="text/javascript">
//<![CDATA[
$(".cat_head:contains('News & Discussion)").next().prepend('<tr><td colspan=\"5\" class=\"c\"><img src=\"http://209.85.62.24/static/1/logo.png\" alt=\"Zetaboards\"></td></tr>');
$(".cat_head:contains('Staff Forum')").next().prepend('<tr><td colspan=\"5\" class=\"c\"><img src=\"http://www.example.com/img.jpg\" alt=\"Another image\"></td></tr>');
//]]>
</script>


If you'd like to change the border-color or background of the cell in which the image is situated, add this attribute to the "td" tag:
Quote:
 
style=\"border-color:#HEX;background:#HEX;\"

Replace the "HEX" with the hex code of the color you want.

Example of this:
Quote:
 
<script type="text/javascript">
//<![CDATA[
$(".cat_head:contains('News & Discussion)").next().prepend('<tr><td colspan=\"5\" class=\"c\" style=\"background:#000;border-color:#ff0000;\"><img src=\"http://209.85.62.24/static/1/logo.png\" alt=\"Zetaboards\"></td></tr>');
//]]>
</script>
Edited by rockon1824, Mar 20 2008, 01:08 PM.
Offline Profile Quote Post Goto Top
 
Nicola
Darth Vader's Sewing Instructor

You get a cookie for being the first person to take advantage of .c.

Thanks for posting this code for a support topic :)
Offline Profile Quote Post Goto Top
 
DragonHybrid
Member Avatar
Member
[ * ]
Yes, thank you very much indeed! Absolutely perfect, thank you again.
Offline Profile Quote Post Goto Top
 
rockon1824
Member Avatar
Member
[ *  * ]
^No problem. :)

Nicola
 
You get a cookie for being the first person to take advantage of .c.

Thanks for posting this code for a support topic :)

Yeah, I got so excited when I noticed the alignment classes in the CSS. They make a lot of things so much easier, especially for webpages and such.
Offline Profile Quote Post Goto Top
 
rockon1824
Member Avatar
Member
[ *  * ]
I just want to note that I updated the code so that when the category is collapsed, the image disappears too.
Offline Profile Quote Post Goto Top
 
Redneck-Melly
Member Avatar
Sweet and Innocent (Hides her horns)
[ *  * ]
Hmm, it isn't working for me
Offline Profile Quote Post Goto Top
 
carastir
Member Avatar
Did you say something?
[ *  *  * ]
Very Nice Code!
Offline Profile Quote Post Goto Top
 
Viral
Member Avatar
i'm stanley nao
[ *  *  *  *  * ]
Redneck-Melly:- Make sure you haven't used any quotation marks. If you have, precede them with backslashes " / ".
Offline Profile Quote Post Goto Top
 
Redneck-Melly
Member Avatar
Sweet and Innocent (Hides her horns)
[ *  * ]
I don't have any click here this is my board, I did exactly llike the instructions said and this is my code.

Code:
 
<script type="text/javascript">
//<![CDATA[
$(".cat_head:contains('The Chapel')").next.prepend('<tr><td colspan=\"5\" class=\"c\"><img src=\"http://i4.photobucket.com/albums/y112/Xx_Melissa_xX/Melly/chapel.png\" alt=\"Chapel\"></td></tr>');
//]]>
</script>
Edited by Redneck-Melly, Mar 20 2008, 11:05 AM.
Offline Profile Quote Post Goto Top
 
Viral
Member Avatar
i'm stanley nao
[ *  *  *  *  * ]
Code: HTML
 
<script type="text/javascript">
//<![CDATA[
$(".cat_head:contains('The Chapel')").next().prepend("<tr><td colspan='5' class='5'><img src='http://i4.photobucket.com/albums/y112/Xx_Melissa_xX/Melly/chapel.png' alt='Chapel'/></td></tr>");
//]]>
</script>


I cleaned up the coding a bit and added () after next. It might work, it might not.
Edited by Viral, Mar 20 2008, 01:12 PM.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
Go to Next Page
« Previous Topic · User Created Codes · Next Topic »
Add Reply