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 »

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.
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 »

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: 72329
Joined: Fri Jun 04, 2004 10:44 am
Location: Oxford, UK
Contact:

Re: Hide/Show BBCode

Post by KevC »

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
"Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb"
ChrisW828
Registered User
Posts: 11
Joined: Thu Oct 26, 2017 3:42 am

Re: Hide/Show BBCode

Post by ChrisW828 »

Thank you so much. I have been searching for three days and this is the first working BBCODE I could find for this.
User avatar
jan_2017
Registered User
Posts: 161
Joined: Sun May 07, 2017 3:39 pm

Re: Hide/Show BBCode

Post by jan_2017 »

ChrisW828 wrote: 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.
Do not work if i use the same spoiler code twice in one post .

:|
User avatar
Mick
Support Team Member
Support Team Member
Posts: 26455
Joined: Fri Aug 29, 2008 9:49 am

Re: Hide/Show BBCode

Post by Mick »

Please start your own topic especially as this one is marked solved.
  • "The more connected we get the more alone we become" - Kyle Broflovski©
  • "The good news is hell is just the product of a morbid human imagination.
    The bad news is, whatever humans can imagine, they can usually create.
    " - Harmony Cobel
Post Reply

Return to “Custom BBCode Development and Requests”