Difference between revisions of "User:Tsutomu25/sandbox/Cover2"
From Detective Conan Wiki
| (15 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | <includeonly><span id="spoiler-box-{{{1}}}">[[#spoiler-target|<span id="show-button-{{{1}}}" class="button-{{{1}}}"></span>]][[#null|<span href="#" id="hide-button-{{{1}}}" class="button-{{{1}}}"></span>]]<span id="spoiler-target-{{{1}}}"></span><span id="spoiler-text-{{{1}}}">{{{2}}}</span></span | + | <includeonly><span id="spoiler-box-{{{1}}}">[[#spoiler-target-{{{1}}}|<span id="show-button-{{{1}}}" class="button-{{{1}}}"></span>]][[#null|<span href="#" id="hide-button-{{{1}}}" class="button-{{{1}}}"></span>]]<span id="spoiler-target-{{{1}}}"></span><span id="spoiler-text-{{{1}}}">{{{2}}}</span></span> |
{{code | {{code | ||
|css= | |css= | ||
/* Styles for the spoiler box */ | /* Styles for the spoiler box */ | ||
| − | #spoiler-box{ | + | #spoiler-box-{{{1}}}{ |
display: inline-block; | display: inline-block; | ||
position: relative; | position: relative; | ||
| Line 11: | Line 11: | ||
/* Styles for the buttons */ | /* Styles for the buttons */ | ||
| − | .button{ | + | .button-{{{1}}}{ |
position: absolute; | position: absolute; | ||
top: 0px; | top: 0px; | ||
| Line 18: | Line 18: | ||
height: 100%; | height: 100%; | ||
} | } | ||
| − | #show-button{ | + | #show-button-{{{1}}}{ |
display: inline-block; | display: inline-block; | ||
z-index: 5; | z-index: 5; | ||
} | } | ||
| − | #hide-button{ | + | #hide-button-{{{1}}}{ |
display: none; | display: none; | ||
z-index: 0; | z-index: 0; | ||
| Line 28: | Line 28: | ||
/* Hiding the target div */ | /* Hiding the target div */ | ||
| − | #spoiler-target{ | + | #spoiler-target-{{{1}}}{ |
display: none; | display: none; | ||
} | } | ||
/* Styles to hide the spoiler text */ | /* Styles to hide the spoiler text */ | ||
| − | #spoiler-text{ | + | #spoiler-text-{{{1}}}{ |
opacity: 0; | opacity: 0; | ||
transition: 0.3s; | transition: 0.3s; | ||
| − | -webkit-user-select: none; | + | -webkit-user-select: none; |
| − | -ms-user-select: none; | + | -ms-user-select: none; |
| − | user-select: none; | + | user-select: none; |
} | } | ||
/* Styles to reveal the spoiler text */ | /* Styles to reveal the spoiler text */ | ||
| − | #spoiler-box:has(#spoiler-target:target){ | + | #spoiler-box-{{{1}}}:hover{ |
| + | background-color: #70717a; | ||
| + | } | ||
| + | #spoiler-box-{{{1}}}:has(#spoiler-target-{{{1}}}:target), #spoiler-box:has(#spoiler-target:target){ | ||
background-color: #e3e3e5; | background-color: #e3e3e5; | ||
} | } | ||
| − | #spoiler-target:target ~ #spoiler-text{ | + | #spoiler-target-{{{1}}}:target ~ #spoiler-text-{{{1}}}, #spoiler-target:target ~ #spoiler-text{ |
opacity: 1; | opacity: 1; | ||
background-color: #e3e3e5; | background-color: #e3e3e5; | ||
| Line 54: | Line 57: | ||
/* Styles to hide the show button and reveal the hide button */ | /* Styles to hide the show button and reveal the hide button */ | ||
| − | #spoiler-box:has(#spoiler-target:target) #show-button{ | + | #spoiler-box-{{{1}}}:has(#spoiler-target-{{{1}}}:target) #show-button-{{{1}}}, #spoiler-box:has(#spoiler-target:target) #show-button{ |
display: none; | display: none; | ||
z-index: 0; | z-index: 0; | ||
} | } | ||
| − | #spoiler-box:has(#spoiler-target:target) #hide-button{ | + | #spoiler-box-{{{1}}}:has(#spoiler-target-{{{1}}}:target) #hide-button-{{{1}}}, #spoiler-box:has(#spoiler-target:target) #hide-button{ |
display: inline-block; | display: inline-block; | ||
z-index: 5; | z-index: 5; | ||
} | } | ||
| + | |||
}} | }} | ||
| + | </includeonly><noinclude> | ||
| + | It hides the given input of spoiler text and reveals them when the user clicks on them. It takes two values. One is the name of the spoiler and another one is the actual spoiler text. Every time the template is used, every element has to have a unique id and class. Hence spoiler name is required. | ||
| − | < | + | == Usage == |
| + | The following is a list of required parameters: | ||
| + | <pre> | ||
| + | {{User:Tsutomu25/sandbox/Cover2|<spoiler name>|<spoiler text>}} | ||
| + | </pre> | ||
| − | + | == Limitations == | |
| + | * When the template is used multiple times on the same page, only one spoiler can remain visible at a time. If the user reveals another spoiler, the previously opened one will automatically be hidden. | ||
| + | * The hyperlinks are not clickable when used inside the template. | ||
| + | * If the page is refreshed while a spoiler is revealed, that spoiler will remain open even after the page reloads. | ||
| − | + | == Examples== | |
| − | + | Result: {{User:Tsutomu25/sandbox/Cover2|weapon|The weapon is Knife}} | |
| − | + | Result: {{User:Tsutomu25/sandbox/Cover2|motive|The culprit wore {{font color|#ffa500|Orange}} clothes}} | |
| + | Result: {{User:Tsutomu25/sandbox/Cover2|culprit|The culprit is [[Gosho Aoyama]]}} | ||
| + | [[Category:Templates]] | ||
</noinclude> | </noinclude> | ||
Latest revision as of 10:38, 23 August 2025
It hides the given input of spoiler text and reveals them when the user clicks on them. It takes two values. One is the name of the spoiler and another one is the actual spoiler text. Every time the template is used, every element has to have a unique id and class. Hence spoiler name is required.
Usage
The following is a list of required parameters:
{{User:Tsutomu25/sandbox/Cover2|<spoiler name>|<spoiler text>}}
Limitations
- When the template is used multiple times on the same page, only one spoiler can remain visible at a time. If the user reveals another spoiler, the previously opened one will automatically be hidden.
- The hyperlinks are not clickable when used inside the template.
- If the page is refreshed while a spoiler is revealed, that spoiler will remain open even after the page reloads.
Examples
Result: The culprit wore Orange clothes
Result: The culprit is Gosho Aoyama