Make sidebar sticky and scroll independently of page content
authorNick Downing <nick@ndcode.org>
Tue, 1 Feb 2022 08:20:33 +0000 (19:20 +1100)
committerNick Downing <nick@ndcode.org>
Sat, 12 Feb 2022 01:53:36 +0000 (12:53 +1100)
_lib/navbar.jst
_lib/page.jst
css/bootstrap/_custom.scss
css/bootstrap/_variables.scss

index 8d16a6d..411c332 100644 (file)
@@ -130,7 +130,7 @@ return async (env, head, body, scripts) => {
       div.scrollbar-fix {
         div.container-fluid {
           div.row {
-            div.'col-md-2'.bg-gray-200 {
+            div.'col-sm-6'.'col-md-4'.'col-lg-3'.'col-xxl-2'.sidebar {
               div.'mt-1'.mb-4 {
                 div(style="width: 128px; height: 128px;") {
                   _out.push(avatar_maker)
@@ -246,7 +246,7 @@ return async (env, head, body, scripts) => {
               //}
             }
 
-            div.col-md-9 {
+            div.col-xl-8 {
               await body(_out)
 
               footer.page-footer.grid-gutter-background.py-5 {
index d07619c..33d7bfc 100644 (file)
@@ -50,7 +50,7 @@ return async (env, head, body, scripts) => {
 
       await head(_out) //title {'Hello, world!'}
     }
-    body {
+    body(style="overflow-x: hidden;") {
       await body(_out) //h1 {'Hello, world!'}
 
       // Optional JavaScript; choose one of the two!
index fac6403..8030696 100644 (file)
@@ -32,6 +32,15 @@ $footer-link-hover-color: darken($footer-link-color, 10%);
   padding-right: .5 * $grid-gutter-width;
 }
 
+.sidebar {
+  position: sticky;
+  top: 0;
+  min-height: 100vh;
+  max-height: 100vh;
+  overflow-y: auto;
+  background-color: $gray-200;
+}
+
 // needed for svg icons inside buttons, card headers, etc
 // creates an inline element with correct width but no height
 // the svg is positioned within this to vertically centre on a capital letter
index 0cd8d18..83baccc 100644 (file)
@@ -197,7 +197,8 @@ $grid-breakpoints: (
   sm: 576px,
   md: 768px,
   lg: 992px,
-  xl: 1200px
+  xl: 1200px,
+  xxl: 1500px // Nick
 ) !default;
 
 @include _assert-ascending($grid-breakpoints, "$grid-breakpoints");
@@ -212,7 +213,8 @@ $container-max-widths: (
   sm: 540px,
   md: 720px,
   lg: 960px,
-  xl: 1140px
+  xl: 1140px,
+  xxl: 1420px // Nick
 ) !default;
 
 @include _assert-ascending($container-max-widths, "$container-max-widths");