Difference between revisions of "Dynamic Navigation"

From Organic Design wiki
m
m
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{legacy}}
 +
 
== Show/Hide Boxes ==
 
== Show/Hide Boxes ==
This method is from [[News:Main Page|Wiki News front page]], it involves three parts, CSS styles, JavaScript code and a template, which follow here:
+
This method is from [[News:Main Page|Wiki News front page]], which are maintained by Wikipedia users [[w:User:Mike Dillon|Mike Dillon]], [[w:User:R. Koot|R. Koot]] and [[w:User:SG|SG]]. The main page covering this is [[wikipedia:Wikipedia:NavFrame|Wikipedia:NavFrame]] (I think). It involves three parts, CSS styles, JavaScript code and a template, which follow here:
  
 
{{Dynamic navigation
 
{{Dynamic navigation
Line 60: Line 62:
 
</css>
 
</css>
 
|SMALLCONTENT=
 
|SMALLCONTENT=
|EXT=NavOnce
+
|EXT=NavOnce NavShow
 
}}
 
}}
  
Line 98: Line 100:
 
     var reCache = {};
 
     var reCache = {};
 
     return function (element, className) {
 
     return function (element, className) {
       return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
+
       return (reCache[className]
 +
        ? reCache[className]
 +
        : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
 
     };
 
     };
 
  })();
 
  })();
Line 293: Line 297:
 
|EXT=NavOnce
 
|EXT=NavOnce
 
}}
 
}}
 +
 +
== To make the first open by default ==
 +
At the end of the last function (called ''createNavigationBarToggleButton'') there are two loops which close all the navbars. The first loops closes the separate navs and the second closes the grouped ones (that can have only one open at a time). To make either kind default to having their first navbar open, start the loop at 2 instead of 1.

Latest revision as of 22:41, 18 November 2014

Legacy.svg Legacy: This article describes a concept that has been superseded in the course of ongoing development on the Organic Design wiki. Please do not develop this any further or base work on this concept, this is only useful for a historic record of work done. You may find a link to the currently used concept or function in this article, if not you can contact the author to find out what has taken the place of this legacy item.


Show/Hide Boxes

This method is from [Page|Wiki News front page], which are maintained by Wikipedia users Mike Dillon, R. Koot and SG. The main page covering this is Wikipedia:NavFrame (I think). It involves three parts, CSS styles, JavaScript code and a template, which follow here:




To make the first open by default

At the end of the last function (called createNavigationBarToggleButton) there are two loops which close all the navbars. The first loops closes the separate navs and the second closes the grouped ones (that can have only one open at a time). To make either kind default to having their first navbar open, start the loop at 2 instead of 1.