Advertisement
-Annie-

JS-for-Golden-Page

Aug 16th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(function () {
  2.     console.log('fsdfs');
  3.  
  4.     $('.page-header').stickyNavbar();
  5.  
  6.     $('.menu-button').on('click', function(){
  7.         $('.page-header nav').slideToggle();
  8.      });
  9.  
  10. var mainOffset = $('#second-section').offset().top;
  11.     var headerHeight = $('.page-header').height() / 1.1;
  12.     //console.log(mainOffset, headerHeight);
  13.     $(window).on('scroll',function(){
  14.         var stop = Math.round($(window).scrollTop() + headerHeight);
  15.         //console.log(stop);
  16.         if (stop > mainOffset) {
  17.             $('.page-header').addClass('past-main');
  18.         } else {
  19.             $('.page-header').removeClass('past-main');
  20.         }
  21.     });
  22. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement