Wikipedia talk:NavFrame
From Wikipedia, the free encyclopedia
[edit] Previously unsectioned comments
I found an example of a use of NafFrame which was apparently copied from another example, and was apparently messed right up. It used three layers of nested divs where only one was needed. I spent 45 minutes looking for docs, and although this was used in dozens of pages and templates, I could not find any docs.
So I started this page. Pleas fill in the copious blanks. —Michael Z. 2006-10-31 05:44 Z
- If there are more than 3 instances of the <div class="NavContent"> on a page then they will all automatically hide themselves. Have a look at MediaWiki:Common.js and find the variable called
NavigationBarShowDefault
. It is set to 3. Some people put 3 instances of <div class="NavContent"> on a page to force the content to be hidden. --Squilibob 10:02, 21 December 2006 (UTC)
[edit] Tabs
NavFrame is not bad, but what I want to see is an implementation of a tabbed interface. With multiple NavFrame elements in a row, I'd like to see all of the headings in one line as tabs, and clicking them shuffles between multiple virtual cards. Can this be done in Wikipedia? —Michael Z. 2006-10-31 05:49 Z
- Yes, it already is done in Wikipedia! ...Well, not so much Wikipedia, but MediaWiki — on the user preferences page using Monobook.css. It accomplished through some kind of JavaScript display trick with the form fieldsets. I have no idea how to apply the style into wiki content, but you're welcome to give it a shot. —Down10 TACO 09:06, 13 January 2007 (UTC)
[edit] table-based version
I've designed a similar solution based on tables. It should be slightly more robust and cause less accessibility issues (and separated the show/hide fucntionality from the navigation box layout at the same time). I'll try to document it here as well. —Ruud 12:44, 1 November 2006 (UTC)
[edit] Display issues in Classic skin
There's a minor problem with the javascript, but I don't know how to deal with. In the monobook skin, the [show]/[hide] button is successfully rendered on the right side of the header, in non-bold text. In the classic skin, there is no space between the button and the header text, and the button is bold if the header is bold. I would fix it, by my javascript skills are inadequte for the task of figuring out what's wrong. Karl Dickman talk 17:36, 28 November 2006 (UTC)
- Fixed by moving CSS code to MediaWiki:Common.css. Karl Dickman talk 09:43, 5 December 2006 (UTC)
[edit] Category:List templates: "hide" instead of "show"
Why does the template {{template category}} display "hide" instead of "show" (while the content is hidden) when the category page is opened? --Eleassar my talk 12:56, 18 January 2007 (UTC)
- Yes, this also seems to happen elsewhere; I'll try to remember to post some links here as/when I come by it again. I suspect it's a bug somewhere...? Regards, David Kernow (talk) 10:51, 25 January 2007 (UTC)
[edit] [hide]/[show] link on the left...?
Is it possible to instruct NavFrame to place the [hide]/[show] link on the left-hand side of the page,
e.g. (if using {{hidden begin}} and {{hidden end}}):
...? Thanks for any help, David Kernow (talk) 10:51, 25 January 2007 (UTC)
- I've made a hack that's achieved this but it very depend on the current code. --Dispenser 07:59, 10 February 2007 (UTC)
[edit] NavContent on span instead of div‽
What needs to be done so that the hiding will work if a SPAN is used instead of a DIV for the inner section? I have an application where I need a subset of the items (which is a run-on list of words) to be visible at all times. Some of them remain outside the NavContent element—basically the section is only semi-collapsed, which is exactly what I need. This "works" when DIVs are used, except that DIV is a block element, so when they are all visible there is a line break that I don't want which breaks up my run-on list. ⇔ ChristTrekker 19:03, 7 February 2007 (UTC)
- I suspect the answer may be "Sorry, you need to use a div for the HTML to work", but in lieu of any HTML experts passing by, is there a link to follow to the situation you describe...? Regards, David Kernow (talk) 01:36, 8 February 2007 (UTC)
- I'm thinking a small hack needs to be made to the JavaScript. MJtemplate is my WIP - original I'm trying to improve on top, my experiment underneath. ⇔ ChristTrekker 16:50, 8 February 2007 (UTC)
- You could try setting the
display:
CSS value to eitherinline-block
orinline
; however, this will likely break the functionality that you wanted. --Dispenser 07:56, 10 February 2007 (UTC)- Both of them looked/functioned identically to the original—no change at all. At least in Firefox, which has good CSS support, so I'm actually a bit surprised. ⇔ ChristTrekker 05:22, 13 February 2007 (UTC)
- I played around with the navframe code back in July to create inline expansion using span elements and
inline
Divs seem to have linebreaks built-in. It even supported alternate texts for hide/show with thetitle
attribute. Couldn't get anyone to test or implement it though. Gimmetrow 22:49, 24 February 2007 (UTC)
- I played around with the navframe code back in July to create inline expansion using span elements and
- Both of them looked/functioned identically to the original—no change at all. At least in Firefox, which has good CSS support, so I'm actually a bit surprised. ⇔ ChristTrekker 05:22, 13 February 2007 (UTC)
[edit] Printable version
Pages that use NavFrames hide content when the page is printed out. Pages or templates using NavFrame should have functionality built into them so that when the user is viewing the printable version of the page the NavFrame is automatically expanded. ~MDD4696 14:33, 16 February 2007 (UTC)
- Should be doable: NavFrame should be modified to use CSS classes to show and hide stuff (instead of directly setting the display property to inline or hidden) and those classes need to be added to common.js to correctly show and hide stuff in webbrowsers, but always show the contents when printed. I'll try to code something similar for the collapsible tables (which should also work correctly in combination with the navbox class, which should always hides the table when printed.) I refuse to work on the currently undocumented, unmaintained and unstable implementation of NavFrame (but might rewrite it from scratch in the future.) —Ruud 15:04, 16 February 2007 (UTC)
- That would be great. I'd try to unravel it myself but don't have the time. ⇔ ChristTrekker 16:13, 19 February 2007 (UTC)
- Suggest that if/when this issue addressed, the printable version mimics the state of each NavFrame on the page rather than automatically expanding all. Regards, David Kernow (talk) 16:17, 16 February 2007 (UTC)
- It's (obviously, I hope) quite hard to expand such frames after being printed so I don't beleive this is a good idea. NavFrame is abused in several places to hide portions of text (not just navigations boxes, actual paragraphs or sections of the article) and those should really be expanded when printed. On the other hand we have the navigational boxes which have absolutely no use on a printed version (paper not supporting hyperlinks and such) and should therefore not even leave a header of a collapsed box behind. —Ruud 18:03, 16 February 2007 (UTC)
[edit] Won't Hide to Start
I've been having some difficulty with this code here, whenever I enter it to my homepage (which is where I want it), it doesn't automatically hide the template I've put in - unless I say style="display:none" in the navcontent - but then the hide/show starts out as hide even though the content is hidden. Any ideas?
<div class="NavFrame">
<div class="NavHead">User Talk Templates</div>
<div class="NavContent">
{{User:Pilotguy/Warnings}} </div> </div>
Thanks for any help you guys can give (oh and note: if I use {{Hidden}} and say 2={{User:Pilotguy/Warnings}} for the second parameter - it works, strangeness.Daniel()Folsom T|C|U 21:22, 19 February 2007 (UTC)
[edit] Wrapping NavFrame around existing content
Hi! I just wrote some javascript to remove some, er, clutter from wikipages (if you've edited more than a few pages, the copywrite warnings are a little redundant). Source is in User:Saintrain/J/deSpamWiki.js. Among the functions, it will put the edit-page "special characters" text block into a collapsed NavFrame. This releases a lot of real estate.
The essence:
- look for the <div ... class="editpage-specialchars"> ... </div>
- create the NavFrame divs
- re-parent the "editpage" div as the NavContent div
- call toggleNavigationBar to collapse it.
So, to all of you who thought of NavFrame and implemented and documented it, Thanks!!! --Saintrain 01:44, 19 March 2007 (UTC)
P.s. and Thanks!!! to Firebug for helping me id the blocks (and maybe find a typo or two).