Page 1 of 1

Hide/Show BBCode

Posted: Tue Oct 27, 2015 5:13 pm
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.)

Re: Hide/Show BBCode

Posted: Wed Oct 28, 2015 12:10 am
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

Re: Hide/Show BBCode

Posted: Wed Oct 28, 2015 10:55 am
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]

Re: Hide/Show BBCode

Posted: Sat Oct 28, 2017 4:34 am
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.

Re: Hide/Show BBCode

Posted: Sun Sep 23, 2018 6:07 am
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 .

:|

Re: Hide/Show BBCode

Posted: Sun Sep 23, 2018 7:48 am
by Mick
Please start your own topic especially as this one is marked solved.