Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Gallery: Difference between revisions

Template page
No edit summary
No edit summary
Line 1: Line 1:
<includeonly>
<includeonly>
<ul class="template gallery" {{#if:{{{perrow|}}}|style="width:{{#expr:({{#rmatch:{{{width|150px}}}|(\d+)|$1}}+9)*{{{perrow}}}}}px"}}>
<ul class="template gallery" {{#if:{{{perrow|}}}|style="width:{{#expr:({{#rmatch:{{{width|150px}}}|(\d+)|$1}}+10)*{{{perrow}}}}}px"}}>
{{#if:{{{caption|}}}|<li class="gallerycaption">{{{caption}}}</li>}}
{{#if:{{{caption|}}}|<li class="gallerycaption">{{{caption}}}</li>}}
{{#forargs:|k|v|{{#rmatch:{{#var:k}}|^\d+$|{{#ifeq:{{#expr:{{#var:k}} mod 2}}|1|<li class="gallerybox">
{{#forargs:|k|v|{{#rmatch:{{#var:k}}|^\d+$|{{#ifeq:{{#expr:{{#var:k}} mod 2}}|1|<li class="gallerybox">
Line 38: Line 38:
}}}}}}
}}}}}}
</includeonly>
</includeonly>





Revision as of 19:12, 1 August 2024



标签 <gallery> 的替代品,支持gif动图

使用方法

调用参数

{{gallery|id=<id>|caption=<caption>|width=<width>|height=<height>|perrow=<perrow>
|file1|title1
|file2|title2
…
|fileN|titleN
}}

必填

  • file:图片名

选填

  • id: gallery 当在同一个页面中需要多次调用此模板时必填
  • caption:gallery的标题
  • width:宽(单位:px)
  • height:高(单位:px)
  • perrow:每行显示数量
  • title:图片提示文字

示例1

你所写的

{{gallery
|file:Main MPI3508.jpg|文字描述
|file:4.0-HDMI-004.jpg|可以指向[[首页]]
|file:4.0-HDMI-004.jpg|
}}

显示内容




示例2

你所写的

{{gallery|id=grallery2|caption=标题|width=300px|height=200px|perrow=2
|file:Main MPI3508.jpg|文字描述
|file:4.0-HDMI-004.jpg|可以指向[[首页]]
|file:4.0-HDMI-004.jpg|
}}

显示内容