Advertisement
PallasKatze

Sticky menu

Mar 14th, 2013
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function($) {
  2.    var w = $(window);
  3.    var menu = $('.main_menu');
  4.    var top = menu.offset().top;
  5.  
  6.    w.scroll(function() {
  7.       if(menu.offset().top <= w.scrollTop()) {
  8.          menu.addClass('fixedtop');
  9.       }
  10.       if(top >= w.scrollTop()) {
  11.          menu.removeClass('fixedtop');
  12.       }
  13.    });  
  14. })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement