Wiki source code of Show Hide Macro
Last modified by jklein on 2025/06/02 14:04
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | Wiki macros implementation for simple show/hide of a content with some animations. | ||
2 | This version 2.0 is HTML compatible with the old version, so that existing project could continue styling | ||
3 | with the same kind of CSS rules. However, it is now based on jQuery, and need requireJS, so it requires | ||
4 | XWiki 5.x or more. | ||
5 | |||
6 | {{info}} | ||
7 | Using ##id="..."## is still supported and provide the same HTML result but it is no more needed to achieve a working animation. | ||
8 | {{/info}} | ||
9 | |||
10 | == Without effect == | ||
11 | |||
12 | {{showhide showmessage="Show" hidemessage="Hide" style="background-color: #ccc"}} | ||
13 | Here is some hidden content that can become visible | ||
14 | Here is some hidden content that can become visible | ||
15 | Here is some hidden content that can become visible | ||
16 | Here is some hidden content that can become visible | ||
17 | {{/showhide}} | ||
18 | |||
19 | {{code}} | ||
20 | {{showhide showmessage="Show" hidemessage="Hide" style="background-color: #ccc"}} | ||
21 | Here is some hidden content that can become visible | ||
22 | Here is some hidden content that can become visible | ||
23 | Here is some hidden content that can become visible | ||
24 | Here is some hidden content that can become visible | ||
25 | {{/showhide}} | ||
26 | {{/code}} | ||
27 | |||
28 | == With a fade in effect == | ||
29 | |||
30 | {{showhide showmessage="Show" hidemessage="Hide" effect="fade" effectduration="2" style="background-color: #ccc"}} | ||
31 | Here is some hidden content that can become visible | ||
32 | Here is some hidden content that can become visible | ||
33 | Here is some hidden content that can become visible | ||
34 | Here is some hidden content that can become visible | ||
35 | {{/showhide}} | ||
36 | |||
37 | {{code}} | ||
38 | {{showhide showmessage="Show" hidemessage="Hide" effect="fade" effectduration="2" style="background-color: #ccc"}} | ||
39 | Here is some hidden content that can become visible | ||
40 | Here is some hidden content that can become visible | ||
41 | Here is some hidden content that can become visible | ||
42 | Here is some hidden content that can become visible | ||
43 | {{/showhide}} | ||
44 | {{/code}} | ||
45 | |||
46 | {{info}} | ||
47 | Using ##effect="appear"## is still supported and provide the same behavior | ||
48 | {{/info}} | ||
49 | |||
50 | == With a sliding down effect == | ||
51 | |||
52 | {{showhide showmessage="Show" hidemessage="Hide" effect="slide" effectduration="0.5" style="background-color: #ccc"}} | ||
53 | Here is some hidden content that can become visible | ||
54 | Here is some hidden content that can become visible | ||
55 | Here is some hidden content that can become visible | ||
56 | Here is some hidden content that can become visible | ||
57 | {{/showhide}} | ||
58 | |||
59 | {{code}} | ||
60 | {{showhide showmessage="Show" hidemessage="Hide" effect="slide" effectduration="0.5" style="background-color: #ccc"}} | ||
61 | Here is some hidden content that can become visible | ||
62 | Here is some hidden content that can become visible | ||
63 | Here is some hidden content that can become visible | ||
64 | Here is some hidden content that can become visible | ||
65 | {{/showhide}} | ||
66 | {{/code}} | ||
67 | |||
68 | {{info}} | ||
69 | This effect is equivalent to ##effect="blind"## in the 1.0 macro, so both ##slide## and ##blind## effect are now using the exact same animation. | ||
70 | {{/info}} |