Difference between revisions of "Template:Segmented control"
Jump to navigation
Jump to search
Line 4: | Line 4: | ||
{{SegmentedControl | {{SegmentedControl | ||
|Title;Wiki page name | |Title;Wiki page name | ||
− | |Image.png | + | |[Image.png]Title;Wiki page name |
− | |Selected title | + | |Selected title |
|etc}} | |etc}} | ||
</pre> | </pre> | ||
Line 12: | Line 12: | ||
{{#vardefine:segmentCount|0}}{{#vardefine:i|1}}{{#while:|{{#if:{{{{{#var:i}}|}}}|true}}|<nowiki/>{{#vardefine:segmentCount|{{#expr:{{#var:segmentCount}}+1}}}}{{#vardefine:i|{{#expr:{{#var:i}}+1}}}}}} | {{#vardefine:segmentCount|0}}{{#vardefine:i|1}}{{#while:|{{#if:{{{{{#var:i}}|}}}|true}}|<nowiki/>{{#vardefine:segmentCount|{{#expr:{{#var:segmentCount}}+1}}}}{{#vardefine:i|{{#expr:{{#var:i}}+1}}}}}} | ||
* Segment count: {{#var:segmentCount}} | * Segment count: {{#var:segmentCount}} | ||
− | {{#vardefine:i|1}}{{#while: | + | <div class="rsToggleContainer"> |
− | |{{# | + | {{#vardefine:i|1}}{{#while:|{{#ifexpr:{{#var:i}}<={{#var:segmentCount}}|true}} |
| <nowiki /> | | <nowiki /> | ||
− | + | {{#vardefine:orderClass|rsSegmentMiddle}} | |
− | {{#vardefine:i|{{# | + | {{#ifexpr:{{#var:i}}=1|{{#vardefine:orderClass|rsSegmentFirst}}}} |
+ | {{#ifexpr:{{#var:i}}={{#var:segmentCount}}|{{#vardefine:orderClass|rsSegmentLast}}}} | ||
+ | {{#vardefine:segment|{{{{{#var:i}}|}}} }} | ||
+ | {{#vardefine:imageAndTitle|{{#explode:{{#var:segment}}|;|0}}}} | ||
+ | {{#vardefine:segmentLink|{{#explode:{{#var:segment}}|;|1}}}} | ||
+ | * {{#var:imageAndTitle}} = {{#var:segmentLink}} | ||
− | + | <div class="rsSegment rsSegmentFirst rsSegmentSelected"> | |
− | + | <div class="rsSegmentFill"> | |
− | + | <span class="rsSegmentTitle">{{#var:imageAndTitle}}</span> | |
− | + | </div> | |
− | + | </div> | |
− | + | {{#vardefine:i|{{#expr:{{#var:i}}+1}} }} | |
− | + | }} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</div> | </div> | ||
</includeonly> | </includeonly> |
Revision as of 16:56, 28 March 2020
Usage example:
{{SegmentedControl |Title;Wiki page name |[Image.png]Title;Wiki page name |Selected title |etc}}