From 3f43ec1af52ba35d7891bb6c1ce67ec605842db5 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 16 Jan 2018 12:23:12 -0500 Subject: [PATCH] Fixing #401 Resolving regression caused by #393, and re-introduced original resize handler method used by @petergood -- placing it behind lodash .debounce should appease @pitaj's concerns, but I frankly see no other way to have this feature but also fix cases where the header is not at the top of the page. --- less/header.less | 4 ---- lib/persona.js | 18 ++++++++++++++++-- yarn.lock | 12 ++++++------ 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/less/header.less b/less/header.less index 48b431f..cbecba5 100644 --- a/less/header.less +++ b/less/header.less @@ -242,10 +242,6 @@ margin-left: -30px; } } - - @media (min-width: @screen-md-min) { - top: 0px !important; - } } .breadcrumb { diff --git a/lib/persona.js b/lib/persona.js index d499883..22403b5 100644 --- a/lib/persona.js +++ b/lib/persona.js @@ -8,11 +8,25 @@ $(document).ready(function() { setupEditedByIcon(); setupMobileMenu(); setupQuickReply(); + configureNavbarHiding(); - $(".navbar-fixed-top").autoHidingNavbar({ - showOnBottom: false + require(['lodash'], function (_) { + $(window).on('resize', _.debounce(configureNavbarHiding, 200)); }); + function configureNavbarHiding () { + var navbarEl = $(".navbar-fixed-top"); + navbarEl.autoHidingNavbar('destroy'); + navbarEl.css('top', ''); + + var env = utils.findBootstrapEnvironment(); + if (env === 'xs' || env ==='sm') { + navbarEl.autoHidingNavbar({ + showOnBottom: false, + }); + } + }; + function setupNProgress() { $(window).on('action:ajaxify.start', function() { NProgress.set(0.7); diff --git a/yarn.lock b/yarn.lock index aca4dae..cd8b23e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,10 +2,10 @@ # yarn lockfile v1 -pulling@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/pulling/-/pulling-1.1.0.tgz#d1460833b623fedcb73c71efb4cbb6824d990749" +pulling@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/pulling/-/pulling-1.1.1.tgz#948c72ec75d76c4ff41d6cec1ef1208c8d9d18f6" -striptags@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/striptags/-/striptags-3.1.0.tgz#763e534338d9cf542f004a4b1eb099e32d295e44" +striptags@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/striptags/-/striptags-3.1.1.tgz#c8c3e7fdd6fb4bb3a32a3b752e5b5e3e38093ebd"