From 2189e07ec4af5dee4b2d2686f6b4f837781a06c5 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Sun, 29 Apr 2012 21:36:54 -0400 Subject: [PATCH 1/1] nitdoc: make the menu follows the scroll. Signed-off-by: Alexandre Terrasa --- share/nitdoc/scripts/js-facilities.js | 27 +++++---- share/nitdoc/styles/main.css | 101 ++++++++++++++++++++++++++------- src/nitdoc.nit | 1 - 3 files changed, 92 insertions(+), 37 deletions(-) diff --git a/share/nitdoc/scripts/js-facilities.js b/share/nitdoc/scripts/js-facilities.js index 7911cb8..0c9f42b 100644 --- a/share/nitdoc/scripts/js-facilities.js +++ b/share/nitdoc/scripts/js-facilities.js @@ -20,12 +20,12 @@ var currentIndex = -1; * Add folding and filtering facilities to class description page. */ $(document).ready(function() { - + /* * Highlight the spoted element */ - highlightBlock(currentAnchor()); - + highlightBlock(currentAnchor()); + /* * Nav block folding */ @@ -226,14 +226,6 @@ $(document).ready(function() { } }); - /* - * Anchors jumps - */ - $("a[href^='#']").click( function() { - var a = $(this).attr("href").replace(/#/, ""); - highlightBlock(a); - }); - // Insert filter field $("article.filterable h2, nav.filterable h3") .after( @@ -349,9 +341,16 @@ $(document).ready(function() { $(this).toggleClass("hidden"); }) - ); - - //Preload filter fields with query string + ); + + /* + * Anchors jumps + */ + $("a[href*='#']").click( function() { + highlightBlock($(this).attr("href").split(/#/)[1]); + }); + + //Preload filter fields with query string preloadFilters(); }); diff --git a/share/nitdoc/styles/main.css b/share/nitdoc/styles/main.css index 07214ec..0a0352e 100644 --- a/share/nitdoc/styles/main.css +++ b/share/nitdoc/styles/main.css @@ -58,6 +58,83 @@ h3 { font-weight: bold; } +/* Page display */ + +body { + overflow: hidden; + height: 100%; +} + +header { +} + +.page { + width: 937px; + margin: auto; +} + +.menu { + position: fixed; + top: 50px; + bottom: 2em; + width: 250px; + overflow-y: scroll; +} + +.content { + position: fixed; + top: 50px; + bottom: 2em; + margin-left: 265px; + width: 667px; + overflow-y: scroll; + padding-right: 10px; +} + +.content.fullpage { + margin-left: 20px; + width: 910px; +} + +footer { + position: fixed; + bottom: 0; + width: 100%; +} + +/* Webkit scroll bars */ + +.menu { + overflow-y: hidden; +} + +.menu:hover { + overflow-y: scroll; +} + +.menu::-webkit-scrollbar, .content::-webkit-scrollbar { + width: 10px; +} + +.menu::-webkit-scrollbar-thumb, .content::-webkit-scrollbar-thumb { + background: #CCC; + -webkit-box-shadow: inset 1px 1px 0 rgba(0,0,0,0.10),inset 0 -1px 0 rgba(0,0,0,0.07); +} + +.menu::-webkit-scrollbar-thumb:hover, .content::-webkit-scrollbar-thumb:hover { + background: #999; +} + +.menu::-webkit-scrollbar-corner, .content::-webkit-scrollbar-corner { + background: transparent; +} + +.menu::-webkit-scrollbar-button, .content::-webkit-scrollbar-button { + width: 0; + height: 0; + display: none; +} + /* Header, Footer */ header nav ul { @@ -84,8 +161,7 @@ header nav ul li a:hover { footer { text-align: center; - padding: 20px 10px; - margin: 10px 100px; + padding-bottom: 10px; color: #CCC; } @@ -101,22 +177,11 @@ header nav.main ul li.current { color: white; } -/* Page content */ - -.page { - width: 940px; - margin: auto; -} - /* Latteral Menu */ -.menu { - width: 250px; - float: left; -} - .menu nav { margin: 20px; + width: 208px; border: 1px solid #CCC; } @@ -155,14 +220,6 @@ header nav.main ul li.current { /* Content */ -.content { - margin: 20px 20px 20px 260px; -} - -.content.fullpage { - margin: 20px; -} - .content section { margin: 20px 0; } diff --git a/src/nitdoc.nit b/src/nitdoc.nit index 59c3f72..a7ec4bd 100644 --- a/src/nitdoc.nit +++ b/src/nitdoc.nit @@ -213,7 +213,6 @@ class DocContext op.append("\}\n") self.gen_dot(op.to_s, "dep", "Modules hierarchy") add("") - add("
") add("") add("") add("\n") -- 1.7.9.5