Template:Multiple image: Difference between revisions
From Zoophilia Wiki
Jump to navigationJump to search
meta>Beyond My Ken Undid revision 382082382 by Thumperward (talk) Not rendering properly under IE |
meta>Waldyrious simplified code / improved readability / added some comments (tested on sandbox) |
||
Line 1: | Line 1: | ||
{{#if:{{{image1|}}}{{{image2|}}}{{{image3|}}}{{{image4|}}}{{{image5|}}}{{{image6|}}}{{{image7|}}}{{{image8|}}}{{{image9|}}}{{{image10|}}}|<div class="thumb {{#switch: {{{align|}}} | left = tleft | center | centre = tnone | tright}}" style="width: {{#switch:{{{direction|}}} | {{#if:{{{image1|}}}{{{image2|}}}{{{image3|}}}{{{image4|}}}{{{image5|}}}{{{image6|}}}{{{image7|}}}{{{image8|}}}{{{image9|}}}{{{image10|}}}|<div class="thumb {{#switch: {{{align|}}} | left = tleft | center|centre = tnone | right|#default = tright}}" style="width: {{#switch:{{{direction|}}}<!-- | ||
| vertical | If stacked vertically, box width = largest width + 12 px (6 px margin on left and right) --> | ||
| horizontal | | vertical = {{#expr: {{{width | {{Max/27 | {{{width1|}}} | {{{width2|}}} | {{{width3|}}} | {{{width4|}}} | {{{width5|}}} | {{{width6|}}} | {{{width7|}}} | {{{width8|}}} | {{{width9|}}} | {{{width10|}}} }} }}} +12 }} | ||
| #default | | horizontal | #default = {{#if:{{{width|}}}<!-- | ||
If stacked horizontally and a single common width was passed for use in all images, | |||
box width = (common width + 4px) * number of images + 8. | |||
This creates a 4px margin between the images, and a 6px margin on each side --> | |||
|{{#expr: | |||
({{{width}}}+4) | |||
* | |||
{{Template:Multiple image/numImgs | {{{image1|}}} | {{{image2|}}} | {{{image3|}}} | {{{image4|}}} | {{{image5|}}} | {{{image6|}}} | {{{image7|}}} | {{{image8|}}} | {{{image9|}}} | {{{image10|}}} }} | |||
+ | |||
8 | |||
}}<!-- | |||
If stacked horizontally and a custom width was passed for each image, | |||
box width = sum of all widths + 4 pixels of margin between each pair of images + 16 pixels of margin (8 on each side of the box) (why not 6px as in other cases?...)--> | |||
|{{#expr: | |||
{{{width1|0}}}+{{{width2|0}}}+{{{width3|0}}}+{{{width4|0}}}+{{{width5|0}}}+{{{width6|0}}}+{{{width7|0}}}+{{{width8|0}}}+{{{width9|0}}}+{{{width10|0}}} | |||
+ | |||
4 * ({{Template:Multiple image/numImgs | {{{image1|}}} | {{{image2|}}} | {{{image3|}}} | {{{image4|}}} | {{{image5|}}} | {{{image6|}}} | {{{image7|}}} | {{{image8|}}} | {{{image9|}}} | {{{image10|}}} }} - 2) | |||
+ | |||
16 | |||
}} | |||
}} | |||
}}px; {{#switch: {{{align|}}} | center | centre = margin: 0 auto;}}{{#if:{{{background color|}}}|background-color: {{{background color}}} }}"> | |||
<div class="thumbinner" {{#if:{{{background color|}}}|style="background-color: {{{background color}}}"}}> | <div class="thumbinner" {{#if:{{{background color|}}}|style="background-color: {{{background color}}}"}}> | ||
{{#if:{{{header|}}}| | {{#if:{{{header|}}}| |