Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. /** hasScrolled:
  2. An event driven function for toggling the expansion and shrinkion of
  3. the main menu bar */
  4.  
  5. function hasScrolled() {
  6. var st = $(this).scrollTop();
  7.  
  8.  
  9. // Make sure they scroll more than delta
  10. if(Math.abs(lastScrollTop - st) <= delta)
  11. return;
  12.  
  13. // If they scrolled down and are past the navbar, add class .nav-up.
  14. // This is necessary so you never see what is "behind" the navbar.
  15. if (st > lastScrollTop && st > navbarHeight){
  16. // Scroll Down
  17. $('header').removeClass('nav-down').addClass('nav-up');
  18. document.getElementById('imgHolder').classList.toggle('rotated');
  19. //document.body.style.paddingTop = '50px';
  20. shrink("logo");
  21.  
  22.  
  23. } else {
  24. if (st == 0) {
  25. $('header').removeClass('nav-up').addClass('nav-down');
  26. document.getElementById('imgHolder').classList.toggle('rotated');
  27. //document.body.style.paddingTop = '250px';
  28. expand("logo");
  29.  
  30. }
  31. /*// Scroll Up
  32. if(st + $(window).height() < $(document).height()) {
  33. $('header').removeClass('nav-up').addClass('nav-down');
  34. }*/
  35. }
  36.  
  37. lastScrollTop = st;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement