Hide/Show BBCode

Get help developing custom BBCodes or request one.
Post Reply
phpeter
Registered User
Posts: 1
Joined: Tue Oct 27, 2015 5:02 pm

Hide/Show BBCode

Post by phpeter » Tue Oct 27, 2015 5:13 pm

Hello,

I am not sure whether this is revision-specific (I assume not). Please move this thread if I have the wrong sub-forum.

For custom BBCode, I checked the wiki. Very clear. I thought I'd ask here first, as I assume I am not the only one who is interested. What would be the code for a Show/Hide function - Buttons and/or text - to show/hide a section of additional material?

(I tried searching, but I did not find any posts about it.)
Last edited by Oyabun1 on Tue Oct 27, 2015 9:30 pm, edited 1 time in total.

User avatar
Pony99CA
Registered User
Posts: 4783
Joined: Thu Sep 30, 2004 3:13 pm
Location: Hollister, CA
Name: Steve
Contact:

Re: Hide/Show BBCode

Post by Pony99CA » Wed Oct 28, 2015 12:10 am

Have you tried searching for "spoiler"? A spoiler BBCode usually hides some text until the user does something, so it may work like you want.

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.

User avatar
KevC
Support Team Member
Support Team Member
Posts: 67314
Joined: Fri Jun 04, 2004 10:44 am
Location: Oxford, UK
Contact:

Re: Hide/Show BBCode

Post by KevC » Wed Oct 28, 2015 10:55 am

https://www.phpbb.com/customise/db/bbcode/spoiler/

I use a slight adaptation that doesn't need the title text.

Code: Select all

[spoiler]{TEXT}[/spoiler]

Code: Select all

<dl class="codebox"><dt><a href="javascript:void(0);" onclick="var el = this.parentNode.parentNode.getElementsByTagName('dd')[0]; var v = el.style.display != 'none'; el.style.display = v ? 'none' : 'block'; this.innerHTML = (v ? '[SPOILER]' : '[HIDE]'); ">[SPOILER]</a></dt><dd style="display: none;">{TEXT}</dd></dl>

Code: Select all

Hidden text: [spoiler]Hidden text[/spoiler]
-:|:- Support Request Template -:|:-
Image
Cheap UK Hosting
"In the land of the blind the little green bloke with no pupils is king - init!"

ChrisW828
Registered User
Posts: 10
Joined: Thu Oct 26, 2017 3:42 am

Re: Hide/Show BBCode

Post by ChrisW828 » Sat Oct 28, 2017 4:34 am

Thank you so much. I have been searching for three days and this is the first working BBCODE I could find for this.

Post Reply

Return to “Custom BBCode Development and Requests”

Who is online

Users browsing this forum: No registered users and 8 guests