Jump to content

Spoiler


DoubleYou

Recommended Posts

Discussion topic:
Template:Spoiler



Purpose & Usage
This template allows text to be clicked like a spoiler to show hidden text immediately underneath it.

Examples
Code:
{{Spoiler|shown=Click Me!|hidden=Where did this come from?}}

Known Issues

 

  • Incompatible with CSS extension
  • The entire line for the text to click to reveal the text will be clickable instead of only the text. /fixed
Link to comment
Share on other sites

The second issue is a limitation of the JS/CSS. Since S4N isn't willing to edit the code due to it being part of the core wiki files, it's just there to stay. I would think it would be simple enough to copy the code and make a new file that simply overrides the core code and that we'd be able to edit completely without messing with the core files; however, this is wiki we're talking about. I seem just about anything simple to do on a normal HTML webpage is rather complicated to do on the wiki.

 

Still that is a nice implementation without having the annoy "[Expand]" text added to the line. Good work!

Link to comment
Share on other sites

Well, I'm not entirely convinced that the second issue is that unfix-able. The limitation is merely there because I don't know what width the word will be for the "Click Me!" text. If there is a way to dynamically change the width based on the length of the word (probably 1em per character), we could have a somewhat elegant solution. I think there may be a way via wiki code to do it, but I don't know yet.

 

The first issue is simply an annoyance. It also makes it so I can't make the "Click Me!" text act change upon hover (well, I can't think of a way besides using the css :hover selector or jquery). It also means if you want to use spoilers, you simply can't use the CSS extension, which means if we implement it on the STEP Guide, we're going to need to remove the custom css file. I'm not sure, however, that everything in that css file might not be doable via in-line css.

 

Now, if we could figure out the incompatibility between the CSS extension and the collapsible functions, we might be able to hack ourselves a solution. The CSS extension hasn't been updated since 2012, so it likely is abandoned, so s4n might not even mind having to modify it.

Link to comment
Share on other sites

  • 8 months later...

Instead of just the Click Me text being the "link" to open the hidden text, it would be clickable for the full horizontal length of the page.

On the template page, only "Click Me!" is hyperlinked, not the entire length of the horizontal line, so still confused ... or do you mean that it used to be the entire line (even blank) that was underlined and clickable?

Link to comment
Share on other sites

  • 6 years later...
  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Guidelines, Privacy Policy, and Terms of Use.