From d71d19e23b64fe9e2c3093e23233e692c9ae56db Mon Sep 17 00:00:00 2001 From: petergood Date: Sun, 17 Dec 2017 18:52:08 +0100 Subject: [PATCH] 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() {