From fd42e9e78eeef7e35ba5a748478297a0bc0fb95e Mon Sep 17 00:00:00 2001 From: Dave Date: Mon, 15 May 2017 18:10:37 -0400 Subject: [PATCH] Fixes for header text shifts on some pages (#216) * make header same size on all pages * Fixes #171 * change search box size on mobile displays * always set body class to docs, set container to layout type * partial for #213 * fix shifting text on mobile displays with blog page * added tab slider to sidebar * fix layout of doc H1 tag with sidebar tab --- _layouts/docs.html | 29 +++++++++++++++++-- js/sidemenu.js | 70 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 js/sidemenu.js diff --git a/_layouts/docs.html b/_layouts/docs.html index 0860b49ee5..af1663b9a1 100644 --- a/_layouts/docs.html +++ b/_layouts/docs.html @@ -4,14 +4,38 @@ layout: default {% include home.html %} {% include doc-top-nav.html %} +
-
+ -
+
+ +
+

{{page.title}}

{{ content }} @@ -22,3 +46,4 @@ layout: default
+ \ No newline at end of file diff --git a/js/sidemenu.js b/js/sidemenu.js new file mode 100644 index 0000000000..9e579dfb20 --- /dev/null +++ b/js/sidemenu.js @@ -0,0 +1,70 @@ +(function($) { + $(document).ready( function() { + var sidebarOpen = true; + var sidebar = $("#sidebar-container"); + var content = $("#content-container"); + var width = $(document). width(); + + function setSidebar() { + // set sidebar height, breakpoint at iPad in landscape + if (screen.height > 768) + sidebar.height($('footer').position().top + 50); + + // 992 is the default breakpoint set in Bootstrap 3 for col-md + if (width < 992) { + sidebar.toggle(); + sidebar.sidebarOpen = !sidebar.sidebarOpen; + } + + /* + // 1756 is a judgement call on the breakpoint for when the sidebar needs a col-lg-3 and not col-lg-12 + if (width < 1756) { + if (sidebar.hasClass("col-lg-2")) + sidebar.removeClass("col-lg-2"); + if (!sidebar.hasClass("col-lg-3")) + sidebar.addClass("col-lg-3"); + + if (content.hasClass("col-lg-10")) + content.removeClass("col-lg-10"); + if (!content.hasClass("col-lg-9")) + content.addClass("col-lg-9"); + } + else { + if (sidebar.hasClass("col-lg-3")) + sidebar.removeClass("col-lg-3"); + if (!sidebar.hasClass("col-lg-2")) + sidebar.addClass("col-lg-2"); + + if (content.hasClass("col-lg-9")) + content.removeClass("col-lg-9"); + if (!content.hasClass("col-lg-10")) + content.addClass("col-lg-10"); + } + */ + } + + $(document).on('click', '#sidebar-tab', function() { + $(this).toggleClass('glyphicon-chevron-right'); + $(this).toggleClass('glyphicon-chevron-left'); + sidebar.toggle(250); + sidebarOpen = !sidebarOpen; + }); + + /* toggle category tree */ + $(document).on('click', '.tree-toggle', function () { + $(this).children('i.fa').toggleClass('fa-caret-right'); + $(this).children('i.fa').toggleClass('fa-caret-down'); + $(this).parent().children('ul.tree').toggle(200); + }); + + function onWindowResize() { + setSidebar(); + } + + // initialize + window.addEventListener('resize', onWindowResize, false); + window.onload = function() { + setSidebar(); + } + }); +}(jQuery));