Difference between revisions of "User:Tsutomu25/sandbox/Cover3"
From Detective Conan Wiki
| Line 31: | Line 31: | ||
height: calc(1em + 13px); | height: calc(1em + 13px); | ||
transition: 0.3s ease-in; | transition: 0.3s ease-in; | ||
| + | /* display: none; */ | ||
visibility: hidden; | visibility: hidden; | ||
opacity: 0; | opacity: 0; | ||
| Line 52: | Line 53: | ||
text-decoration: none; | text-decoration: none; | ||
color: black; | color: black; | ||
| + | /* font-size: 9pt; */ | ||
} | } | ||
| − | #spoiler-box-{{{1}}}:hover #show-button-{{{1}}}{ | + | #spoiler-box-{{{1}}}:hover .button-container-{{{1}}}:has(#show-button-{{{1}}}){ |
visibility: visible; | visibility: visible; | ||
opacity: 1; | opacity: 1; | ||
| Line 59: | Line 61: | ||
z-index: 5; | z-index: 5; | ||
} | } | ||
| − | #spoiler-box-{{{1}}}:hover #hide-button-{{{1}}}{ | + | #spoiler-box-{{{1}}}:hover .button-container-{{{1}}}:has(#hide-button-{{{1}}}){ |
transform: translate(-50%, 0); | transform: translate(-50%, 0); | ||
} | } | ||
| Line 71: | Line 73: | ||
#spoiler-text-{{{1}}}{ | #spoiler-text-{{{1}}}{ | ||
opacity: 0; | opacity: 0; | ||
| − | transition: 0.3s; | + | transition: 0.3s ease-in; |
-webkit-user-select: none; /* Safari */ | -webkit-user-select: none; /* Safari */ | ||
-ms-user-select: none; /* IE 10 and IE 11 */ | -ms-user-select: none; /* IE 10 and IE 11 */ | ||
| Line 96: | Line 98: | ||
/* Styles to hide the show button and reveal the hide button */ | /* Styles to hide the show button and reveal the hide button */ | ||
#spoiler-box-{{{1}}}:hover:has(#spoiler-target-{{{1}}}:target) .button-container-{{{1}}}:has(#show-button-{{{1}}}){ | #spoiler-box-{{{1}}}:hover:has(#spoiler-target-{{{1}}}:target) .button-container-{{{1}}}:has(#show-button-{{{1}}}){ | ||
| + | /* display: none; */ | ||
visibility: hidden; | visibility: hidden; | ||
opacity: 0; | opacity: 0; | ||
| Line 101: | Line 104: | ||
} | } | ||
#spoiler-box-{{{1}}}:hover:has(#spoiler-target-{{{1}}}:target) .button-container-{{{1}}}:has(#hide-button-{{{1}}}){ | #spoiler-box-{{{1}}}:hover:has(#spoiler-target-{{{1}}}:target) .button-container-{{{1}}}:has(#hide-button-{{{1}}}){ | ||
| + | /* display: flex; */ | ||
visibility: visible; | visibility: visible; | ||
opacity: 1; | opacity: 1; | ||
Revision as of 11:55, 26 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/Cover3|<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.
- If the page is refreshed while a spoiler is revealed, that spoiler will remain open even after the page reloads.
Examples
Result: The weapon is Knife
Result: The culprit wore Orange clothes
Result: The culprit is Gosho Aoyama