diff --git a/scripts/custom.js b/scripts/custom.js index 97703de..5c9694c 100644 --- a/scripts/custom.js +++ b/scripts/custom.js @@ -43,9 +43,12 @@ $(document).on('ready pjax:scriptcomplete',function(){ * screen sizes (theme options headersticky + headersticky{computer,tablet, * mobile}, applied as media queries in custom_header.twig). The parent * theme.js fixBodyPadding() assumes a permanently fixed header and always - * sets body padding-top to the header height; this correction runs after it - * and removes that padding when the header is NOT fixed at the current - * viewport width (computed position != 'fixed'). + * sets body padding-top to the header height (and the parent theme.css + * statically sets body { padding-top: 90px }); this correction runs after + * it (custom.js loads after theme.js) and sets the padding to the header + * height when the header IS fixed at the current viewport width, or to 0 + * when it is NOT (computed position != 'fixed') — so a non-sticky header + * sits at the very top of the page. */ var fixBodyPaddingSticky = function () { var nav = $('#survey-nav'); @@ -53,7 +56,10 @@ $(document).on('ready pjax:scriptcomplete',function(){ if (nav.css('position') === 'fixed') { $('body').css('padding-top', Math.round(nav.height()) + 'px'); } else { - $('body').css('padding-top', ''); + /* NOT '' (clearing the inline style): that would fall back to the + parent theme.css rule body { padding-top: 90px } and push the + static header 90px down. Set 0 explicitly. */ + $('body').css('padding-top', '0px'); } }; // namespaced so re-running on pjax:scriptcomplete never stacks duplicate handlers