var SearchCollapse = document.getElementById('SearchCollapse') var bsCollapse = new bootstrap.Collapse(SearchCollapse, { toggle: false }) document.addEventListener("DOMContentLoaded", function(){ gwp_autohide = document.querySelector('.autohide'); navbar_height = document.querySelector('.navbar').offsetHeight; document.body.style.paddingTop = navbar_height + 'px'; if(gwp_autohide){ var last_scroll_top = 0; window.addEventListener('scroll', function() { var y = window.scrollY; let scroll_top = window.scrollY; if(scroll_top < last_scroll_top || y < navbar_height) { gwp_autohide.classList.remove('scrolled-down'); gwp_autohide.classList.add('scrolled-up'); } else { gwp_autohide.classList.remove('scrolled-up'); gwp_autohide.classList.add('scrolled-down'); } last_scroll_top = scroll_top; }); } });