scripts.js 883 B

12345678910111213141516171819202122232425
  1. //var SearchCollapse = document.getElementById('SearchCollapse')
  2. //var bsCollapse = new bootstrap.Collapse(SearchCollapse, {toggle: false})
  3. document.addEventListener("DOMContentLoaded", function(){
  4. gwp_autohide = document.querySelector('.autohide');
  5. navbar_height = document.querySelector('.navbar').offsetHeight;
  6. document.body.style.paddingTop = navbar_height + 'px';
  7. if(gwp_autohide){
  8. var last_scroll_top = 0;
  9. window.addEventListener('scroll', function() {
  10. var y = window.scrollY;
  11. let scroll_top = window.scrollY;
  12. if(scroll_top < last_scroll_top || y < navbar_height) {
  13. gwp_autohide.classList.remove('scrolled-down');
  14. gwp_autohide.classList.add('scrolled-up');
  15. }
  16. else {
  17. gwp_autohide.classList.remove('scrolled-up');
  18. gwp_autohide.classList.add('scrolled-down');
  19. }
  20. last_scroll_top = scroll_top;
  21. });
  22. }
  23. });