模板:Navbox with collapsible groups/sandbox

文档图示 模板文档[查看] [编辑] [历史] [清除缓存]


本模板产生的导航模板含有许多个group。所有组别下的文章都是关于同一个主题的。所有group在默认状态下都是隐藏的,但是通过呼叫一个参数(点击右上角的“显示”),一个单独的group可以被展开。

用法 编辑

模板当前支持10个groups/lists,但如果需要,可以加入更多的group。你至少应该使用2个groups/lists,否则请使用{{Navbox}}。

{{Navbox with collapsible groups
|name = {{subst:PAGENAME}}
|state = 
|selected = {{{1|}}}

|title = 
|titlestyle = 
|groupstyle = 
|image = 

|group1 = 
|abbr1 = 
|list1 =

|group2 = 
|abbr2 = 
|list2 = 

 ...

|group10 = 
|abbr10 = 
|list10 = 
}}

参数 编辑

本模板和它的姐妹模板{{Navbox}}、{{Navbox with columns}}使用许多通用的参数。通用参数用一个十字符号标明。要深入了解这些参数的详细介绍和实例,请参见{{Navbox}}。

属性参数 编辑

name
模板名。比如模板的名字可以是“Navbox with collapsible groups。”
state [autocollapse, uncollapsed, collapsed, plain, off]
主标题显示/隐藏的初始状态。更多信息请查看{{Navbox}}。这不影响其下各group的显示或隐藏状态,参加下面的staten
navbar
可取的值为plainoff,以及默认的留空。更多信息请查看{{Navbox}}。
border
可取的值为childnone,以及默认的留空。如果你希望将一个导航框(navbox)置于另一个navbox之内,则设为child;选择这个值时,子navbox将紧贴在父navbox内,没有边框。父navbox可以是{{Navbox}}的list区,也可以是{{Navbox with columns}}的一个栏(column),{{Navbox with collapsible groups}}的list区。更多信息和范例请查看{{Navbox}}。

基本数据参数 编辑

title
模板的标题,在顶端的标题栏居中显示。
above
在groups/lists上方显示的文字或者其他元素。
image
在所有groups/lists右边显示的图片。
imageleft
在所有groups/lists左边显示的图片。
below
在groups/lists下方显示的文字或者其他元素。

groups/lists参数 编辑

groupn
每部分的标题。
listn
在group中显示的内容/维基链接。用 . (dot)或者 · ({{·}},bullet)作为分隔符(见参见)。可以选择将一个{{Navbox}}或者{{Navbox with columns}}置于此处,要用到它的border = child参数。如果已经这样做,请将对应的group n 留空,因为它的子navbox已经提供了收起(collapsible)功能。
abbrn
这是group的缩写。参见下面的参数以了解如何使用。selected参数是可选的,但建议使用。
selected
如果selected的值与 abbrn 的值相同,则第 n list是展开的,而所有其他list是收起的。如果将selected留空,或者它不与任何 abbrn 想匹配,则所有group都是收起的。一般将这个参数设为{{{1|}}}。Since this template is a base template for others, there has to be a way to pass the group parameter from the article, to the secondary template to this one.
staten [autocollapse, uncollapsed, collapsed, plain, off]
listn 展开/收起的初始状态。默认状态为收起。如果selectedabbrn 相同,则改为展开。
imagen
出现在listn 内容区右边的一个图片。
imageleftn
出现在listn 内容区左边的一个图片。

样式参数 编辑

bodystyle
应用于整个模板的CSS样式
titlestyle
应用于标题栏的CSS样式;一般设为background:color。维基链接文字的颜色必须使用span标签手动调整。例如使用title = [[Scouting|<span style="color:ivory;">Scouting</span>]]将链接的颜色改为改变ivory。“显示”/“隐藏”按键和“查”“论”“编”链接按键使用标题样式参数中设定的颜色。这里是一个设置标题样式的范例:
titlestyle = background:darkgreen;color:ivory;
abovestyle
belowstyle
分别应用于above and below参数的CSS样式。
basestyle
同时应用于titleabovebelowgroupn的CSS样式。
imagestyle
应用于image参数的CSS样式。不适用于 imagen 参数。
imageleftstyle
应用于imageleft参数的CSS样式。不适用于 imageleftn 参数。
groupstyle
应用于所有group头部参数的CSS样式。访问this website以获得与头部背景色相似的明亮颜色。范例:
groupstyle = background:lightgreen;
groupnstyle
应用于特定group头部的CSS样式;能改变在groupstyle中已经设定过的任何CSS样式。
liststyle
应用于所有list内容参数的CSS样式。
listnstyle
应用于特定list内容的CSS样式;能改变在liststyle中已经设定过的任何CSS样式。
listpadding
每个list单元格的边距;默认状态下,左右为0.25em,上下为0em。

范例 编辑

{{Navbox with collapsible groups
|name = University of Michigan
|title = [[University of Michigan|<span style="color:#FFD700;">The University of Michigan, Ann Arbor</span>]]
|titlestyle = background:#00008B;color:#FFD700;
|groupstyle = background:#FFD700;color:#00008B;
|image = 
|selected = {{{1|}}}
|state = collapsed

|group1 = [[University of Michigan#Academic profile|<span style="color:#00008B;">Academics</span>]]
|abbr1 = academics
|list1 = [[University of Michigan College of Engineering|College of Engineering]]{{·}} [[University of Michigan College of Literature, Science, and the Arts|College of Literature, Science and the Arts]]{{·}} [[Gerald R. Ford School of Public Policy]]{{·}} [[University of Michigan Law School|Law School]]{{·}} [[University of Michigan Health System|Medical School]]{{·}} [[Ross School of Business]]{{·}} [[University of Michigan School of Education|School of Education]]{{·}} [[University of Michigan School of Information|School of Information]]{{·}} [[University of Michigan School of Music, Theatre & Dance|School of Music, Theatre & Dance]]{{·}}[[University of Michigan School of Natural Resources and Environment|School of Natural Resources and Environment]]{{·}} [[University of Michigan School of Public Health|School of Public Health]]{{·}} [[Taubman College of Architecture and Urban Planning]]

|group2 = [[Michigan Wolverines|<span style="color:#00008B;">Athletics</span>]]
|abbr2 = athletics
|list2 = [[Michigan Stadium|Michigan Stadium]]{{·}} [[Crisler Arena|Crisler Arena]]{{·}} [[Yost Ice Arena|Yost Ice Arena]]{{·}} [[Michigan Wolverines|Michigan Wolverines]]{{·}} [[Michigan Wolverines football|Football]]{{·}} [[Michigan-Ohio State rivalry|UM-OSU Rivalry]]{{·}} [[Little Brown Jug (football)|Little Brown Jug]]{{·}} [[Paul Bunyan Trophy]]{{·}} [[Cold War (ice hockey)|Cold War]]

|group3 = Campus
|abbr3 = campus
|list3 = [[Angell Hall Observatory]]{{·}} [[Burton Tower]]{{·}} [[The Diag]]{{·}} [[David M. Dennison Building|Dennison Building]]{{·}} [[Gerald R. Ford Presidential Library]]{{·}} [[Hill Auditorium|Hill Auditorium]]{{·}} [[Lurie Tower]]{{·}} [[Matthaei Botanical Gardens]]{{·}} [[Michigan Union]]{{·}} [[Museums at the University of Michigan|Museums]]{{·}} [[Nichols Arboretum]]{{·}} [[University of Michigan Health System|UM Health System]]{{·}} [[University of Michigan Library|University Library]]

}}

参见 编辑

导航模板比较
可折叠? 标题颜色 图像 组别 样式(主体)
参数
范例
{{Navbox}} navbox 主体左/右侧 {{H:f Help}}
{{Navbox with columns}} navbox 栏左/右侧 {{APEC}}
{{NavboxYears}} navbox
{{Navbox with collapsible groups}} navbox 主体左/右侧 及/或 在每列表中 {{ATI}}
折叠属性
类别 CSS class Javascript 何时折叠 自定义
初始状态
套叠结构
Collapsible tables collapsible Common.js定义 页面有两块或以上autocollapse模板