Help talk:Collapsing
![]() | See also Wikipedia talk:NavFrame. |
![]() | This help page does not require a rating on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||||
|
Layering hide/show
[edit]Could the hide/show be layered so that it does not interfere with the centering of the text within the field? Currently the centered text is offset by the hide/show and is driving me batty trying to figure a way around it.
.hide_show_class { z-index:2; }
Something like that might work. - LA @ 15:39, 2 November 2007 (UTC)
Um
[edit]Collapsible tables suck.. why are we going back 10 years to tables when we have a div based solution? --ffroth 12:52, 2 December 2007 (UTC)
So, what is the div-based solution?
Unformatted text
[edit]Is there a way to put pre-formatted content in a collapsible table? 63.118.244.2 (talk) 20:18, 23 December 2009 (UTC)
"Not accessibility friendly"
[edit]What does that mean? Has anyone ever analysed how well screen reader software copes with them, and if people are able to follow them easily and interact with them without sight? Given how frequently these things are used now it seems very important. • Anakin (contribs • complaints) 03:01, 31 December 2007 (UTC)
- I know it's almost a year since the question was posted, but for anyone wondering - some points:
- If you're using Opera/Firefox/IE8 you can disable CSS to get a rough idea of what screen-readers will "see" - basically the page should be linear, making it easy for the blind and visually impaired to envisage the layout (straight down, top to bottom). Layout tables (used in the code for all of these collapsible examples), disrupt this paradigm, as they are 2 dimensional - navigation is right-to-left as well as top-to-bottom.
- Also, accessibility is not reserved to the visually impaired. Other physically impaired users may have difficulty with keyboard/mouse usage and may interface with computers in alternate ways. For this reason, normal mouse-navigation cannot be assumed, and the above points about simplifying navigation apply equally here.
column width?
[edit]Is it possible to set individual column widths? - TheMightyQuill (talk) 21:57, 17 March 2008 (UTC)
show/hide all?
[edit]I have a page with dozens of collapsible tables. Is it possible to have a button that expands all or collapses all, in addition to the individual show/hide buttons? —Preceding unsigned comment added by 69.241.122.68 (talk) 20:06, 4 September 2008 (UTC)
- Same question. Anyone know? Calendar (talk) 16:11, 15 September 2008 (UTC)
- Only as a personal userscript (not for everybody else). —AlexSm 16:24, 15 September 2008 (UTC)
- Thanks - care to elaborate? (this is the original poster) —Preceding unsigned comment added by 69.241.122.68 (talk) 19:48, 1 October 2008
- The JavaScript code that collapses table was added to this project's global JS file MediaWiki:Common.js. This code is executed for every visitor, so you can use collapsible tables on any page and they will work (except for visitors with JS disabled in their browsers).
- On the other hand, you can register and then use your special personal subpage to add some JavaScript code that will be executed just for you (see WP:US for more info). It will not be executed for everybody else, so you won't be able to use this functionality in articles. —AlexSm 20:44, 1 October 2008 (UTC)
- I understand that, but I'm referring to my own private MediaWiki Wiki, not the main MediaWiki site. Is there code that exists so I can have all users expand all tables or collapse all tables on a page, rather than opening and closing individually? —Preceding unsigned comment added by 69.241.122.68 (talk) 13:48, 7 October 2008 (UTC)
- Thanks - care to elaborate? (this is the original poster) —Preceding unsigned comment added by 69.241.122.68 (talk) 19:48, 1 October 2008
- Only as a personal userscript (not for everybody else). —AlexSm 16:24, 15 September 2008 (UTC)
- Is there still no way to do this? —Pengo 02:51, 12 September 2011 (UTC)
- Bump. Yea this would be really useful 123.3.9.239 (talk) 05:31, 29 May 2016 (UTC)
- Looking for same, please advise.156.68.229.129 (talk) 17:33, 1 April 2020 (UTC)
Collapsible Divs?
[edit]Does anyone know if it's at all possible to get this effect using elements other than tables? Something along the lines of:
<div> <a>Show/Hide</a> <div style="display:none;"> Content </div> </div>
- lucideer 23:57, 14 November 2008 (UTC) —Preceding unsigned comment added by Lucideer (talk • contribs)
Left-hand side show/hide link ?
[edit]I tried to make a table with the show link on the left instead of the right, and this is the best I can manage. Is there a better way, and if so could an example be placed on the help page? Thank you. 84user (talk) 03:05, 18 December 2008 (UTC)
Code entered | Output produced | ||||
---|---|---|---|---|---|
{| class="wikitable collapsible" style="width:95%;" ! style="position:absolute;text-align:left;width:3em;" | ! style="text-align:left;padding-left:4em" |details |- | colspan=2| Lorem ipsum dolor sit amet Is there a better way to get the same results as from [[Template:Hidden begin]] with toggle=left? |} |
|
I managed to switch the show/hide side by editing Common.css (float="left" instead of float="right") but it applies everywhere.70.164.107.205 (talk) 21:24, 10 June 2009 (UTC)
MediaWiki:Common.js
[edit]Where do you find MediaWiki:Common.js, for example local settings in the config folder? please help me. thanks Xxxsacheinxxx (talk) 15:18, 18 February 2009 (UTC)
> Is it a wiki page. Type it in the search box of your wiki
>> And what if that page does not exist on my wiki? can I just create it? —Preceding unsigned comment added by 203.94.167.153 (talk) 00:50, 23 February 2010 (UTC)
Dependency with collapsible tables
[edit]I only wanted collapsible tables so I only copied the part of Wikipedia's Mediawiki:Common.js relating to that. There is a dependency though in the js for the following function which you also need to copy as well,:
/* Test if an element has a certain class ************************************** * * Description: Uses regular expressions and caching for better performance. * Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]] */ var hasClass = (function () { var reCache = {}; return function (element, className) { return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className); }; })();
So if it isn;t working for you check that you've got this function in your Mediawiki:common.js
82.35.81.250 (talk) 10:35, 25 February 2009 (UTC)
- Thank you for pointing that out. This should be documented in the help page itself. --Lance E Sloan (talk) 20:39, 2 March 2009 (UTC)
MediaWiki:Common.js and MediaWiki:Common.css
[edit]Besides changes to MediaWiki:Common.js, to implement collapsible tables in your own wiki the same way they are in Wikipedia requires changes to MediaWiki:Common.css as well. It would be nice to have a document of all the changes necessary to implement collapsible tables. --Lance E Sloan (talk) 20:37, 2 March 2009 (UTC)
- I believe that this is the way to do it: http://www.mediawiki.org/wiki/Manual:Collapsible_tables . Place both the CSS and JS at the bottom of the respective CSS and JS, and it should work. --Toussaint (talk) 04:18, 11 March 2009 (UTC)
Image instead of "Show" / "Hide" Text
[edit]I found where in the Javascript to change the text of the show/hide button itself, but I'm looking for a way to invoke an image by URL for the button. How do I go about doing this? Guy.yedwab (talk) 18:08, 9 July 2009 (UTC)
- This page is pretty poorly trafficked, why don't you try Wikipedia:Help desk Agradman talk/contribs
- correction --- per the caption above, try Wikipedia talk:NavFrameAgradman talk/contribs
Collapsible columns
[edit]Could this feature please be extended to allow the collapsing work on those columns only whose header cell has the class ‘collapsible’ set? This would be useful where tables are too wide and not too high. (I guess someone could also wish to collapse certain rows only or exclude specific rows or columns.) — Christoph Päper 15:35, 1 March 2010 (UTC)
- As it turns out collapsing only specific rows is quite simple for opt-out, a bit more complex for opt-in and even more complex for columns. The opt-out class name is debatable, I have used ‘nocollapse’ for now, but something similar or ‘static’ could also be used, and ‘sortbottom’ is excluded by default, too. Find code for intermediate steps in a previous revision.
- This code has not been tested yet – at all! I guarantee at least 3 bugs. Always test your code! — Christoph Päper 21:00, 1 March 2010 (UTC)
- There are now several tests, the simple ones are passed, but colspan and rowspan complicate matters. — Christoph Päper 11:33, 10 March 2010 (UTC)
- Help:Collapsing/Test Doesn't work
I am using Firefox 3.6.6, all of the rows and columns collapse and uncollapse. Adamtheclown (talk) 16:31, 8 July 2010 (UTC)
- Did you put the code in one of your JS files, e.g. User:Adamtheclown/vector.js? — Christoph Päper 19:15, 8 July 2010 (UTC)
I am trying to have only certain rows collapsible using media wiki syntax, can any of you assist me with this? I am trying to show the first couple rows and leave the rest UN-collasped initially. October 30th 2014 — Preceding unsigned comment added by Aflemmingfish (talk • contribs) 20:52, 30 October 2014 (UTC)
Collapse template
[edit]Extended content
|
---|
{{{1}}}
|
How about {{collapse}}. Kasaalan (talk) 07:34, 6 June 2010 (UTC)
Clicking Show/Hide Moves cursor to Start of Page
[edit]Tracklist table: I've added the following templates and the table displays properly:
- Template:Tracklist
- Template:Track listing
- Template:Track listing/Track
- Template:Collapsible list
I've also added Wikipedia's "MediaWiki:Common.js" file to my own site
The Show/hide links works by showing the table or hiding it when the link is clicked. However it also moves the cursor to the start of the page. Can anyone please tell me how to fix this? Holygamer (talk) 18:47, 24 June 2010 (UTC)
Multiple Column Collapsible?
[edit]I'm having some difficulty creating a multiple Column Collapsible table from the examples provided. HELP PLEASE.-- Avazina, an Unreconstructed Southerner 15:53, 1 September 2010 (UTC)
- I dont even know if that is possible. Adamtheclown (talk) —Preceding undated comment added 11:47, 12 January 2011 (UTC).
Footnotes to collapsed tables: Autoexpand?
[edit]I have just made several tables in Empire Test Pilots' School collapsible and collapsed. If one clicks on a footnote to an entry in a collapsed table, nothing happens. The desirable (i.e. user-friendly) behaviour IMHO would be for the appropriate table to be expanded to show the referenced entry; otherwise the tables will have to be left expanded, which defeats the object. Is this auto-expansion possible? Thanks. --TraceyR (talk) 11:10, 27 January 2011 (UTC)
Problem with sortable and collapsible
[edit]I'm experiencing a problem with sortable and collapsible. Apparently, both of them cannot work together. I tried on this test page. Can anyone help me? Lonelydarksky (暗無天日) contact me (聯絡) 17:41, 18 February 2011 (UTC) Correction. The problem is that the collapsible doesn't work when sortable is in place. Lonelydarksky (暗無天日) contact me (聯絡) 17:42, 18 February 2011 (UTC)
- Wikipedia:Village pump (technical)#Table show/hide disfunction. — AlexSm 18:31, 18 February 2011 (UTC)
Problem with bold header
[edit]Hello!
Is there a way of creating a collapsible header that has its text not in bold? (this)
Thanks! Momergil (talk) 17:04, 17 March 2011 (UTC)
Collapsible tables vs. Collapse top/bottom (cot/cob)
[edit]Doesn't seem to be much practical difference between the two, so does anyone know why would it be better to chose one over the other? The content in question is currently in a table so it seems logical to use collapsible tables but in the Help for Collapse (top and bottom) it mentions it can also be used to collapse complex content that includes tables. Doesn't seem to be any clear indication which is recommended. Page in question: http://en.wikipedia.org/wiki/Apple_iOS_version_history (Jd2157 (talk) 15:03, 8 September 2011 (UTC))
Collapsing templates within a larger collapsible template?
[edit]I'm having some problems using the collapse function on this page. I've collapsed the two internal templates (which is good), but I'm not able to collapse the larger template that encompasses them.
Any suggestions? Is this a coding limitation, or am I doing something wrong? CJCurrie (talk) 04:41, 13 November 2012 (UTC)
- Please disregard -- I've changed the formatting on what I was doing. CJCurrie (talk) 00:30, 14 November 2012 (UTC)
Translations of "show" and "hide"
[edit]The labels "show" and "hide" are (meant to be) provided in the local language on non-English wikis ("afficher" and "masquer" in the French Wikipedia, for example), so where do these translations come from? Translatewiki, or somewhere else? - dcljr (talk) 20:02, 16 September 2013 (UTC)
- (Answering my own question. I think.) They seem to be coming from MediaWiki:Common.js:
var collapseCaption = 'hide';
var expandCaption = 'show';- Hmm. This seems a bit "hacky". Wouldn't a solution using Translatewiki (somehow) actually be better? - dcljr (talk) 22:44, 19 September 2013 (UTC)
Usage of this template on wiki-site.com
[edit]I tried to use this template on wiki-site.com, but I failed. It doesn't hide the body. What can I do? NAME XXX (talk) 20:10, 6 October 2013 (UTC).
- I think you also need to copy some code out of MediaWiki:Common.js, the section beginning with "Collapsible tables" inside a large JavaScript comment. If you can't see how to make it work, I suggest you ask the experts at Village pump (technical). -- John of Reading (talk) 20:17, 6 October 2013 (UTC)
- Thank you! But, unfortunately, there is no answer there. Maybe, you can help? I'm not the wiki-admin on site, and usual "<script></script>" tag doesn't work. NAME XXX (talk) 20:51, 8 October 2013 (UTC).
Recent edit seems to have broken most of the info here
[edit]With a recent edit [1] all aspects of class "collapsible" were changed to "mw-collapsible" for no apparent reason. But this broke things quite considerably: although the class "mw-collapsible" is roughly comparable, many of the switches like "collapsed", "autocollapse", "outercollapse", "innercollapse" no longer function, as is painfully aware from the non-working examples. While there is equivalent classes such as "mw-collapsed" I am not aware of classes for all these functions. Surely the page should be changed back to class "collapsible"? --Jules (Mrjulesd) 16:11, 18 October 2016 (UTC)
- Redrose64. I see you reverted my change. Could you please answer the above question? Most of the content of the page is broken because of the changes. Also surely some description of class collapsible is warranted, if only discuss it as being deprecated? If class collapsible is still in use (e.g. by Module:Navbox, and many other places) this needs to be described. The simple fact is mw-collapsible is far less feature rich and comprehensive, meaning its use is limited even if it is recommended. mw-collapsible also leads to sizeable lag on my system. --Jules (Mrjulesd) 18:51, 18 October 2016 (UTC)
- Your diff above shows lots of changes by Evolution and evolvability (talk · contribs), most of which I reverted. I'm pretty sure that the
mw-collapsible
class has come up somewhere like WP:VPT. --Redrose64 (talk) 19:24, 18 October 2016 (UTC)- Redrose64 That's true, it wasn't introduced by you. But you reverted my reintroduction of class collapsible [2] so I'm asking you, shouldn't we go back to class collapsible? As I explained above most of the examples on the page no longer function because of this. --Jules (Mrjulesd) 19:32, 18 October 2016 (UTC)
- There is doc at mw:Manual:Collapsible elements. At MediaWiki talk:Common.js and archives, there are comments from Edokter (talk · contribs) and TheDJ (talk · contribs) who I think are in a better position to answer this. --Redrose64 (talk) 20:36, 18 October 2016 (UTC)
- Redrose64 That's true, it wasn't introduced by you. But you reverted my reintroduction of class collapsible [2] so I'm asking you, shouldn't we go back to class collapsible? As I explained above most of the examples on the page no longer function because of this. --Jules (Mrjulesd) 19:32, 18 October 2016 (UTC)
- Your diff above shows lots of changes by Evolution and evolvability (talk · contribs), most of which I reverted. I'm pretty sure that the
- The reason is that mw-collapsible is a MediaWiki core functionality and collapsible and other stuff is old style (English) Wikipedia specific code. As far as I can tell the switches all still work, but possibly not for you. Please accurately describe the examples that don't work for you, as well as the browser you use etc etc etc.. —TheDJ (talk • contribs) 21:24, 18 October 2016 (UTC)
- Eh wait a minute. I think I see what you mean.. We need to add something to MediaWiki:Commonj.js that I figured would already be in there...
function mwCollapsibleSetup( $collapsibleContent ) {
var $element,
autoCollapseThreshold = 2;
$.each( $collapsibleContent, function (index, element) {
$element = $( element );
if ( index > autoCollapseThreshold && $element.hasClass( 'autocollapse' ) ) {
$element.data( 'mw-collapsible' ).collapse();
} else if ( $element.hasClass( 'innercollapse' ) ) {
if ( $element.parents( '.outercollapse' ).length > 0 ) {
$element.data( 'mw-collapsible' ).collapse();
}
}
} );
}
mw.hook( 'wikipage.collapsibleContent' ).add( mwCollapsibleSetup );
- —TheDJ (talk • contribs) 21:34, 18 October 2016 (UTC)
- Edit request. I thought we had deployed that here a long while ago after finally fixing phab:T72762. It seems neither Edokter nor I got around to it however. —TheDJ (talk • contribs) 21:41, 18 October 2016 (UTC)
- Right, that code is now deployed. Having said that, I agree with Mrjulesd that it is probably best to keep the documentation for the old style as well, just as we have done for WP:NAVFRAME. BTW. The core collapisble code has many more functionalities that are however rather undocumented. Some examples can be seen on testwiki:User:Krinkle/Test_suite_for_mw-collapsible. —TheDJ (talk • contribs) 13:40, 20 October 2016 (UTC)
- Edit request. I thought we had deployed that here a long while ago after finally fixing phab:T72762. It seems neither Edokter nor I got around to it however. —TheDJ (talk • contribs) 21:41, 18 October 2016 (UTC)
- —TheDJ (talk • contribs) 21:34, 18 October 2016 (UTC)
Collapsing a table used in a template.
[edit]I need some help to optionally collapse a table which is used in a template. The table is already formatted as collapsible in the template {{WRC driver results legend}}. The table is expanded by default, which is fine. What I wan't to be able to do is to have in collapsed state in a select few of the occasions were it is called upon using the {{WRC driver results legend}} syntax.Tvx1 15:59, 23 January 2017 (UTC)
Languages
[edit]This doesn't apply to the English Wikipedia, but recently, the table with the option to change languages is collapsed in most versions of Wikipedia. Even when you uncollapse, it doesn't go back to normal, but opens a small window showing some random languages, then other languages sorted into different regions. You have to scroll through it and the lists are arranged into columns, making it more difficult. This feature is a step back. Please fix it. --92.75.199.236 (talk) 11:13, 13 March 2017 (UTC)
- This is not the page for requesting fixes to anything other than the help page Help:Collapsing. I suggest that you follow the advice at WP:Bugs and file a ticket at Phabricator. --Redrose64 🌹 (talk) 14:22, 13 March 2017 (UTC)
Collapsible userboxes
[edit]A note at Wikipedia:Userboxes#Using_collapsible_tables links here, but it's not immediately clear how to apply collapsible wikitables in that setting. This help page could use some specific examples in that setting. --Theodore Kloba (talk) 15:07, 4 August 2017 (UTC)
Button-Layout to Hide/Show sections
[edit]Is it possible to display the Hide/Show buttons not like an edit-link, but like a button?
Not like [Hide] or [Show] like [Edit] , but more like Hide or Show or ⊟ or ⊞
--79.207.126.55 (talk) 13:38, 22 October 2017 (UTC)
- Not from this end. It's part of the MediaWiki software, so you would need to file a feature request at phabricator:. But I think that it would be considered a major change, since the present method uses
<a>...</a>
tags to make a link to a JavaScript routine - a button would need to use a<button />
or perhaps<input />
tag. --Redrose64 🌹 (talk) 15:48, 22 October 2017 (UTC)- To make Text look like a button you use the style attribute of
span
,div
, ... - To make Text look like a button you use the style attribute of
span
,div
, ... - To make Text look like a button you use the style attribute of
span
,div
, ... - --79.207.126.55 (talk) 19:13, 23 October 2017 (UTC)
- You still need to file a req at phab. --Redrose64 🌹 (talk) 10:21, 24 October 2017 (UTC)
- To make Text look like a button you use the style attribute of
Getting collapsing to work on mobile
[edit]How difficult would it be to get infobox collapsing working for mobile? It'd be really nice if a sizable chunk of the 1 million readers per day going to 2019–20_coronavirus_pandemic didn't have to scroll through a bunch of maps before getting to the article itself. Sdkb (talk) 01:00, 26 March 2020 (UTC)
Collapsing part of a Wikitable
[edit]Is it possible to collapse part of a wikitable, but not the whole thing. For example, this would be useful on long election results tables to hide minor parties but retain the info for anyone who wants to know the full details. Cheers, Number 57 22:10, 19 April 2020 (UTC)
- Only by using subtables. --Redrose64 🌹 (talk) 20:20, 20 April 2020 (UTC)
Partially-collapsing tables
[edit]Hello Redrose. Thanks for your response at Help talk:Collapsing. I've tried making a partially-collapsing table at User:Number_57/sandbox#Table. Although it's almost right, when it looks fine on my laptop, the columns of the inlaid table are very slightly off (by a single pixel) on my mobile. When I fix it on that, they are slightly off on my laptop. Do you have any idea what's going wrong and whether it can be made to be right on both? Cheers, Number 57 19:11, 21 April 2020 (UTC)
Collapsing image
[edit]Is it possible to collapse an image? 103.67.158.47 (talk) 20:26, 24 July 2020 (UTC)
- Yes, if you enclose it in a suitable div. --Redrose64 🌹 (talk) 21:55, 25 July 2020 (UTC)
Manipulating the toggle label
[edit]How to move the toggle label by some indentation left or right, and to change its font? thx. maimonid (talk) 10:02, 17 May 2022 (UTC)
How to collapse multiple rows by default?
[edit]I can't anything for it... Viu54071 (talk) 00:18, 24 January 2023 (UTC)
Discussion at Template talk:Collapsible option § Readability overhaul
[edit] You are invited to join the discussion at Template talk:Collapsible option § Readability overhaul. {{u|Sdkb}} talk 20:14, 22 July 2023 (UTC)
Relevant BRFA
[edit] You are invited to join the discussion at Wikipedia:Bots/Requests for approval/SdkbBot 4. {{u|Sdkb}} talk 05:10, 2 August 2023 (UTC)