Advertisement
Slightom

Untitled

Jan 17th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function () {
  2.     var NavY = $('#navigationPanel').offset().top;
  3.     var stickyNav = function () {
  4.         var ScrollY = $(window).scrollTop();
  5.  
  6.         if (ScrollY >= NavY) {
  7.             $('#navigationPanel').addClass('sticky');
  8.         } else {
  9.             $('#navigationPanel').removeClass('sticky');
  10.         }
  11.     };
  12.  
  13.     stickyNav();
  14.  
  15.     $(window).scroll(function () {
  16.         stickyNav();
  17.     });
  18.  
  19.     new ResizeSensor(jQuery('#navigationPanel'), function () {
  20.                
  21.         var newHeight = document.getElementById('navigationPanel').clientHeight;
  22.         document.getElementById('navigationWrapper').setAttribute("style", "height:" + newHeight + "px");
  23.     });
  24. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement