From 784c82fc4b1b687011fbef01f2466ef631e3b07b Mon Sep 17 00:00:00 2001 From: Lucy Cifferello <12953208+elvece@users.noreply.github.com> Date: Wed, 14 Apr 2021 14:59:19 -0600 Subject: [PATCH] navbar toggle fixes --- README.md | 2 ++ source/_static/default.css | 8 +++++++- source/_static/js/main.js | 21 ++++++++++++--------- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d4ec8bf..c3dabd7 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ pip3 install sphinx-book-theme || pip install git+https://github.com/executableb Run: `sphinx-autobuild source build/html` to activate a live-reload environment on `localhost:8000`. +To run in development mode when actively changing js/css files run: `sphinx-autobuild source build/html source/_static/js/main.js source/_static/default.css`. this will auto-load with changes to noted files. + The main configuration file for this project is located at `./source/conf.py`. The navigation structure is aligned with the folder/file organization under `./source/`. This is where the individual page `.rst` files live and can be edited. diff --git a/source/_static/default.css b/source/_static/default.css index 3f61bb2..a2d99b0 100644 --- a/source/_static/default.css +++ b/source/_static/default.css @@ -1,6 +1,8 @@ -body, h1, h2, h3, h4, nav, .topbar, .topbar-main, .tocsection, .form-control, .bd-toc { +body, p, h1, h2, h3, h4, nav, .topbar, .topbar-main, .tocsection, .form-control, .bd-toc, .bd-sidebar { background-color: #2b2b2b!important; color: #f8f8ff!important; + /* font-family: Lato,sans-serif!important; */ + line-height: 1.65; } h1 { @@ -190,4 +192,8 @@ nav.bd-links > ul.nav { .navbar-brand-box { text-align: center; +} + +.above { + margin-top: -1000px!important; } \ No newline at end of file diff --git a/source/_static/js/main.js b/source/_static/js/main.js index f58e98d..e6c1388 100644 --- a/source/_static/js/main.js +++ b/source/_static/js/main.js @@ -1,8 +1,7 @@ -$(document).ready(function () { +$(document).ready(function (e) { // open external links in separate tab $('a[href^="http://"], a[href^="https://"]').not('a[class*=internal]').attr('target', '_blank'); - $(".fa-arrow-left").attr("class", "fas fa-times"); - $(".fa-arrow-up").attr("class", "fas fa-times"); + // toggle hidable sections $(".toggle > *").hide(); $(".toggle .admonition-title").show(); @@ -10,12 +9,16 @@ $(document).ready(function () { $(this).parent().children().not(".admonition-title").toggle(400); $(this).parent().children(".admonition-title").toggleClass("open"); }) - // default menu to open on initial load - $('.site-navigation').removeClass('collapsing'); - $('.site-navigation').removeClass('collapse'); - $('.site-navigation').addClass('show'); - // initially hide menu close button - $('.fa-times').addClass('hidden'); + + // change appearance of arrow to X for menu closing + $(".fa-arrow-left").attr("class", "fas fa-times"); + $(".fa-arrow-up").attr("class", "fas fa-times"); + + // initially hide menu close button on small screen widths + if ($(window).width() < 768) { + $('.fa-times').addClass('hidden'); + } + $('#navbar-toggler').click(function() { // toggle menu open/close button depending on collapsed state if ($('#navbar-toggler').hasClass("collapsed")) {