From d71d19e23b64fe9e2c3093e23233e692c9ae56db Mon Sep 17 00:00:00 2001 From: petergood Date: Sun, 17 Dec 2017 18:52:08 +0100 Subject: [PATCH 1/3] Fixed navbar autohide after viewport resize --- lib/persona.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/persona.js b/lib/persona.js index 1f3ff90..f1a6c05 100644 --- a/lib/persona.js +++ b/lib/persona.js @@ -3,18 +3,25 @@ /*globals ajaxify, config, utils, app, socket, NProgress*/ $(document).ready(function() { - var env = utils.findBootstrapEnvironment(); + $(".navbar-fixed-top").autoHidingNavbar({ + showOnBottom: false, + disableAutohide: true + }); setupNProgress(); setupTaskbar(); setupEditedByIcon(); setupMobileMenu(); setupQuickReply(); + updateAutoHidingNavbar(); - if (env === 'xs' || env ==='sm') { - $(".navbar-fixed-top").autoHidingNavbar({ - showOnBottom: false - }); + $(window).on('resize', function() { + updateAutoHidingNavbar(); + }); + + function updateAutoHidingNavbar() { + var env = utils.findBootstrapEnvironment(); + $(".navbar-fixed-top").autoHidingNavbar('setDisableAutohide', !(env === 'xs' || env ==='sm')); } function setupNProgress() { From 377fbfd2b0d3d25d7ec3135ac44cdc538f4ba654 Mon Sep 17 00:00:00 2001 From: petergood Date: Mon, 18 Dec 2017 12:37:23 +0100 Subject: [PATCH 2/3] Added media query to determine if header should auto hide --- less/header.less | 4 ++++ lib/persona.js | 15 +++------------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/less/header.less b/less/header.less index d825d6c..a525ed4 100644 --- a/less/header.less +++ b/less/header.less @@ -242,6 +242,10 @@ margin-left: -30px; } } + + @media (min-width: @screen-md-min) { + top: 0px !important; + } } .breadcrumb { diff --git a/lib/persona.js b/lib/persona.js index f1a6c05..f7c5383 100644 --- a/lib/persona.js +++ b/lib/persona.js @@ -3,27 +3,18 @@ /*globals ajaxify, config, utils, app, socket, NProgress*/ $(document).ready(function() { - $(".navbar-fixed-top").autoHidingNavbar({ - showOnBottom: false, - disableAutohide: true - }); + var env = utils.findBootstrapEnvironment(); setupNProgress(); setupTaskbar(); setupEditedByIcon(); setupMobileMenu(); setupQuickReply(); - updateAutoHidingNavbar(); - $(window).on('resize', function() { - updateAutoHidingNavbar(); + $(".navbar-fixed-top").autoHidingNavbar({ + showOnBottom: false }); - function updateAutoHidingNavbar() { - var env = utils.findBootstrapEnvironment(); - $(".navbar-fixed-top").autoHidingNavbar('setDisableAutohide', !(env === 'xs' || env ==='sm')); - } - function setupNProgress() { $(window).on('action:ajaxify.start', function() { NProgress.set(0.7); From 46941dec93a4fb8a51885072cf641e4d5034f50d Mon Sep 17 00:00:00 2001 From: petergood Date: Mon, 18 Dec 2017 12:42:38 +0100 Subject: [PATCH 3/3] Removed redundant code --- lib/persona.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/persona.js b/lib/persona.js index f7c5383..d499883 100644 --- a/lib/persona.js +++ b/lib/persona.js @@ -3,8 +3,6 @@ /*globals ajaxify, config, utils, app, socket, NProgress*/ $(document).ready(function() { - var env = utils.findBootstrapEnvironment(); - setupNProgress(); setupTaskbar(); setupEditedByIcon();