From 629abf7c1b70ca6c1aa1703f11703d7917063431 Mon Sep 17 00:00:00 2001 From: Yannick Schaus Date: Tue, 6 Feb 2018 08:43:54 +0100 Subject: [PATCH] [Misc]Improve navigation on mobile devices (#639) - Make the sidebar useable again - Add the search field back and move it to the top - Move the category navigation tree from the content area to the sidebar, preserving the hierarchy These changes have no effect outside mobile mode (width <= 992px). Fixes #487. Signed-off-by: Yannick Schaus --- _includes/header.html | 13 ++-- css/openhab.css | 152 ++++++++++++++++++++++++++++++++++++++++++ js/init.js | 3 + 3 files changed, 162 insertions(+), 6 deletions(-) diff --git a/_includes/header.html b/_includes/header.html index 2e48fa384..1fdaa4f1a 100644 --- a/_includes/header.html +++ b/_includes/header.html @@ -53,17 +53,18 @@ diff --git a/css/openhab.css b/css/openhab.css index dcb71798d..204106337 100644 --- a/css/openhab.css +++ b/css/openhab.css @@ -112,6 +112,8 @@ input.gsc-input { #querymob { color: #000; + padding-left: 40px !important; + width: 260px; } /* Address (on imprint page) */ @@ -133,3 +135,153 @@ footer .list-inline > li { padding-right: 5px; padding-left: 5px; } + +/* Overrides for mobile mode */ + +#sidenav-overlay { + z-index: 995; +} + +#nav-mobile { + top: 64px; + padding-bottom: 150px; +} + +#nav-mobile .search .material-icons { + color: #aaa; + position: absolute; + left: 10px; + line-height: 50px; +} + +#nav-mobile .search-form ::-webkit-input-placeholder { + color: #aaa; +} + +#nav-mobile .search-form ::-moz-placeholder { + color: #aaa; +} + +#nav-mobile .search-form ::-ms-input-placeholder{ + color: #aaa; +} + +@media only screen and (max-width: 992px) { + + body.documentation section.text .side-nav-wrapper { + display: none; + } + + /* Mobile mode side Nav */ + + /* All Menu Links */ + .side-nav-mobile ul.nav { + margin-bottom: 20px; + } + + .side-nav-mobile li.active { + background: none; + } + + .side-nav-mobile ul.nav > li { + color: black; + font-size: 80%; + } + + .side-nav-mobile ul.nav > ul { + padding: 0 !important; + } + + .side-nav-mobile ul.nav a { + padding: 5px 10px; + font-size: 1rem; + line-height: 24px; + height: 36px; + display: block; + color: #01324D; + text-align: left; + font-weight: 300; + } + + .side-nav-mobile ul.nav ul { + height: auto !important; + } + + /* First Level Menu Links Hover */ + .side-nav-mobile ul.nav > li > a:hover { + background: #EEE; + } + + /* First Level Menu Links */ + .side-nav-mobile ul.nav li a:after { + font-family: "Material Icons"; + speak: none; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + text-rendering: auto; + -webkit-font-smoothing: antialiased; + content: ""; + position: absolute; + right: 10px; + } + + /* First level menu with sub nav */ + .side-nav-mobile ul.nav li a.has-submenu:after { + content: "keyboard_arrow_down"; + } + + /* Active first level menu link */ + .side-nav-mobile ul.nav li.active > a { + color: #039be5; + background: #EEE; + } + + .side-nav-mobile ul.nav li.active a:after { + + } + + /* First level menu with sub nav opened */ + .side-nav-mobile ul.nav li.active.open a:after { + content: "keyboard_arrow_up"; + } + + .side-nav-mobile ul.nav li.active ul li a:hover { + background: none; + } + + + .side-nav-mobile ul.nav li.active.open ul li a:after { + content: none; + display: none; + } + + /* Second level menu with sub nav */ + .side-nav-mobile ul.nav li.active.open ul li a.has-submenu:after { + content: "keyboard_arrow_down"; + display: inline; + } + + /* Second level menu with sub nav opened */ + .side-nav-mobile ul.nav li.active.open ul li.open a.has-submenu:after { + content: "keyboard_arrow_up"; + } + + /* Active second level menu link */ + .side-nav-mobile ul.nav li.active ul li.active a { + background: none; + } + + .side-nav-mobile ul.nav ul { + display: none; + margin: 0px; + padding: 0px 0px 0px 20px; + background-color: #F6F6F6; + } + + .side-nav-mobile ul.nav hr, .side-nav-mobile div.content hr { + border: 1px solid #CCC; + margin: 6px 2px 4px 2px; + } +} \ No newline at end of file diff --git a/js/init.js b/js/init.js index 052dba473..c2c58050f 100644 --- a/js/init.js +++ b/js/init.js @@ -77,6 +77,9 @@ function initSideNav() { } }); + var sideNavMobileSection = (linkUrl.indexOf('/developer') == 0) ? 'developer' : (linkUrl.indexOf('/tutorials') == 0) ? 'tutorials' : 'user'; + $('section ul.nav').clone().appendTo('#side-nav-mobile-' + sideNavMobileSection); + // Sticky SideNav if (!window.onLandingPage) { var isSmall = $(window).width() <= 600;