MyBB Community Forums

Full Version: Spoiler MyCode
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Title: Spoiler

Short Description: Spoiler (uses jQuery)

Regular Expression:
\[spoiler\](.*?)\[/spoiler\]

Replacement:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript">$(document).ready(function(){$("button.spoilerbutton").click(function(){$("div.spoilerreveal").slideDown("slow");});});</script><button class="spoilerbutton">Reveal Spoiler</button><div style="background:lightblue;border:2px solid teal;padding:3px;display:none;" class="spoilerreveal"><p style="text-align:center;font-weight:bold;">Spoiler:</p>$1</div>
Note: For some reason I can't explain, you need to include the first line, even if jQuery is already included in your theme.

Since its interactive, I have a live demo on my board. It's located at this post and is the second MyCode shown.

EDIT: I added two classes.
Your boards don't let me see inside the spoiler, because a huge black registration box fills up the entire screen when I try to open it.
(2012-07-07, 02:22 PM)cappazushi Wrote: [ -> ]Your boards don't let me see inside the spoiler, because a huge black registration box fills up the entire screen when I try to open it.

It was a problem with the HTML, it wasn't working right. I fixed it, and updated the first post.