changeset 58:2e2e9feba1f3 kai

Refactor top navigation.
author Kai T. Ohlhus <k.ohlhus@gmail.com>
date Tue, 11 Oct 2016 15:59:18 +0200
parents 002d154531d4
children 9ed0088bf27f
files _includes/footer.html _includes/header.html css/octave.css
diffstat 3 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/_includes/footer.html	Tue Oct 11 15:57:58 2016 +0200
+++ b/_includes/footer.html	Tue Oct 11 15:59:18 2016 +0200
@@ -5,7 +5,7 @@
 </footer>
 
 <script>
-function myFunction() {
+function topnav() {
   var x = document.getElementById("myTopnav");
   if (x.className === "topnav") {
     x.className += " responsive";
--- a/_includes/header.html	Tue Oct 11 15:57:58 2016 +0200
+++ b/_includes/header.html	Tue Oct 11 15:59:18 2016 +0200
@@ -7,14 +7,19 @@
 
 
 <ul class="topnav" id="myTopnav">
-  <li><a href="{{ "/index.html" | prepend: site.baseurl }}">Home</a></li>
-  {% for page in site.pages %}
-    {% if page.menu %}
-  <li><a href="{{ page.url | prepend: site.baseurl }}">{{ page.title }}</a></li>
+  <li><a href="{{ "/index.html" | relative_url }}">Home</a></li>
+  {% for mpage in site.pages %}
+    {% if mpage.menu %}
+    <li>
+      <a href="{{ mpage.url | relative_url }}"
+        {% if page.url == mpage.url %} class="active"{% endif %}>
+      {{ mpage.title }}</a>
+    </li>
     {% endif %}
   {% endfor %}
+  <li><a href="{{site.docs_url}}">Docs</a></li>
   <li class="icon">
-    <a href="javascript:void(0);" onclick="myFunction()">
+    <a href="javascript:void(0);" onclick="topnav()">
       {% octicon list-unordered height:18 class:"right left" %}
     </a>
   </li>
--- a/css/octave.css	Tue Oct 11 15:57:58 2016 +0200
+++ b/css/octave.css	Tue Oct 11 15:59:18 2016 +0200
@@ -141,7 +141,9 @@
   vertical-align: baseline;;
 }
 
-ul.topnav li a:hover {
+ul.topnav li a:hover,
+ul.topnav li a:focus,
+ul.topnav li a.active {
   background-color: #555;
 }