scripts.js 883 B

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