Test2 — различия между версиями

Материал из Энциклопедия вселенной Diablo
Перейти к: навигация, поиск
(Новая страница: «== Collapsible table == To make any table collapsible, add a special class <code>collapsible</code> For example, the following table is defined with <code>{| cla…»)
 
 
Строка 1: Строка 1:
== Collapsible table ==
+
<html><div id="flash-container">
To make any table collapsible, add a special class <code>collapsible</code>
+
<object type="application/x-shockwave-flash" data="http://media.blizzard.com/global-video-player/themes/d3/video-player.swf?nocache=1387306576841" width="720" height="400" id="flash-video" style="visibility: visible;">
 
+
<param name="allowFullScreen" value="false"/>
For example, the following table is defined with <code>{| class="collapsible wikitable"</code>:
+
<param name="bgcolor" value="#000000"/>
 
+
<param name="allowScriptAccess" value="always"/>
{| class="collapsible wikitable"
+
<param name="wmode" value="opaque"/>
!Always displayed header
+
<param name="menu" value="false"/>
|-
+
<param name="flashvars" value="flvPath=http://media.blizzard.com/d3/media/videos/extended-retrospective/extended-retrospective-en_US.flv&flvWidth=720&flvHeight=400&captionsPath=http://media.blizzard.com/d3/media/videos/extended-retrospective/captions/ru-ru.xml&captionsDefaultOn=true&ratingFadeTime=1&ratingShowTime=4&=true&ratingPath=http://media.blizzard.com/global-video-player/ratings-png/pegi-16.png&locale=ru-ru&dateFormat=dd/MM/yyyy"/>
|Optionally displayed text; optionally displayed text
+
</object>
|}
+
</div></html>
 
+
===Initial state===
+
Collapsible table is initially expanded by default.
+
 
+
You can change this with two additional special classes:
+
* '''autocollapse''': table will be collapsed if there are more than 2 collapsible tables on the page,
+
* '''collapsed''': table will be initially collapsed.
+
 
+
Example: <code>{| class="wikitable collapsible collapsed"
+
{| class="wikitable collapsible collapsed"
+
!Always displayed header
+
|-
+
|Initially hidden text.
+
|}
+
</code>
+
 
+
===Table width===
+
Since usually the natural width of the header is smaller than of the main content, the table' width will increase after expanding and it will "jump" around. (Also, even if the header would fit in the width of the browser window, the layout engine might divide it over two lines.) It is ugly in itself and inconvenient if you want only to have a quick look at the hidden content and then collapse it again without having to hunt the link with cursor in between. This is prevented by explicitly setting table's <code>width</code>, which then remains the same in the collapsed and expanded state.
+
 
+
Compare this to the first example: <code>{| class="collapsible wikitable" style="width:34em"</code>
+
{| class="collapsible wikitable" style="width:34em"
+
! Always displayed header, table has width:34em
+
|-
+
| optionally displayed text: you can see it doesn't matter at all that this is so much longer, table width has been set at 34em
+
|}
+
 
+
===Usage===
+
For content that is not a table one can create a table with only one element with content, and a header. However there's a table-less, purely DIV-based solution available on the Wikipedia - see [[#Collapsible DIV]] below.
+
 
+
For existing table one can simply add collapsible class. If the table has several colums, it might be a good idea to add a heading row consisting of one cell otherwise the link will be in the first one. Sometimes an easy solution is to put the whole table as element inside another table (see example below); however this is bad from the webdesign and usability viewpoint.
+
 
+
===Sortable collapsible table===
+
 
+
[[help:sorting|Sortable]] table inside a collapsible table:
+
 
+
{| style="width:40em"
+
! width=50% | initially expanded !! initially collapsed
+
|-
+
|class="collapsible"||class="collapsible collapsed"
+
|-
+
|
+
{| class="collapsible"
+
!numbers
+
|-
+
|
+
{| class="wikitable sortable"
+
!name!!number
+
|-
+
|a||123
+
|-
+
|b||6
+
|-
+
|c||45
+
|}
+
|}
+
|
+
{|class="collapsible collapsed"
+
!numbers
+
|-
+
|
+
{|class="wikitable sortable"
+
!name!!number
+
|-
+
|a||123
+
|-
+
|b||6
+
|-
+
|c||45
+
|}
+
|}
+
|}
+
 
+
If the sortable table is itself made collapsible the positioning of the hide/show button is a bit odd:
+
 
+
{| style="width:40em"
+
!initially expanded!!initially collapsed
+
|-
+
|class="wikitable sortable collapsible"||class="wikitable sortable collapsible collapsed"
+
|-
+
|
+
{|class="wikitable sortable collapsible"
+
!name!!number
+
|-
+
|a||123
+
|-
+
|b||6
+
|-
+
|c||45
+
|}
+
|
+
{|class="wikitable sortable collapsible collapsed"
+
!name!!number
+
|-
+
|a||123
+
|-
+
|b||6
+
|-
+
|c||45
+
|}
+
|}
+
 
+
__NOTOC__
+

Текущая версия на 22:12, 17 декабря 2013