Guest User

Untitled

a guest
May 22nd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. // Header menu scrolling
  2. var scrollLink = $(".scroll");
  3.  
  4. scrollLink.click(function(e){
  5. e.preventDefault();
  6. $("body,html").animate({
  7. scrollTop: $(this.hash).offset().top
  8. }, 1000);
  9. });
  10.  
  11. // Menu Active scrolling
  12. $(window).scroll(function(){
  13. var scrollbarLocation = $(this).scrollTop();
  14.  
  15. scrollLink.each(function(){
  16. var sectionOffset = $(this.hash).offset().top - 30;
  17.  
  18. if ( sectionOffset <= scrollbarLocation ) {
  19. $(this).parent().addClass("active");
  20. $(this).parent().siblings().removeClass("active");
  21. }
  22.  
  23. })
  24.  
  25. })
Add Comment
Please, Sign In to add comment