From e6949532d7f61d6f02192a44eb0416ee682e3ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 18 Nov 2020 22:22:02 -0500 Subject: [PATCH] fix: topic-list-header when navbar disappears --- public/persona.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/public/persona.js b/public/persona.js index 6fba6ad..417a0eb 100644 --- a/public/persona.js +++ b/public/persona.js @@ -45,15 +45,23 @@ $(document).ready(function () { showOnBottom: false, }); } - navbarEl.on('show.autoHidingNavbar', function() { + + function fixTopCss(topValue) { if (ajaxify.data.template.topic) { - $('.topic .topic-header').css({top: '' }); + $('.topic .topic-header').css({top: topValue }); + } else { + var topicListHeader = $('.topic-list-header'); + if (topicListHeader.length) { + topicListHeader.css({ top: topValue }); + } } + } + + navbarEl.on('show.autoHidingNavbar', function() { + fixTopCss(''); }); navbarEl.on('hide.autoHidingNavbar', function() { - if (ajaxify.data.template.topic) { - $('.topic .topic-header').css('top', '0px'); - } + fixTopCss('0px'); }); }