1
I’m implementing a bbcode of spoilers for a phpbb forum, which uses Bootstrap and jQuery in theme.
The code is this:
<div class="panel-group">
<div class="panel panel-warning">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#collapse1">SPOILER!</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse">
<div class="panel-body">{TEXT}</div>
</div>
</div>
I’m having doubts, since the bbcode code will be the same for every spoiler block and so apparently I can’t use the id for the element collapse1
, because any spoiler in the topic will use that same id.
The question then is: how will I "trigger" a collapsable crash without using an id?
Thank you very much!
The worst is that I would need a version of that code on an onclick on
<a data-toggle="collapse" href="#collapse1">SPOILER!</a>
, because phpbb only allows me to use a single chunk of code for each bbcode. Ah, and if you need to change the HTML (putting some javascript like the one I suggested above), you can change it.– Vico
That’s almost it! Pity the function of Collapse just show the element, it does not hide again in the next click
– Vico
Just pass the toggle as an argument for Ollapse, tomorrow I’ll make a fiddle :)
– Brunno
Thanks, I’ll look forward to it! The solution won’t look really elegant, but it’s the only way phpbb will accept it! Anyway, thanks for the help!
– Vico
@Vico, follow the example with the toggle :)
– Brunno
Tested, added and working beauty in forum! (following example) Marked as accepted! Thank you very much!
– Vico