kaioe
4/16/2017 - 4:58 PM

javascript: Menu fixed top on scroll

Menu fixed top on scroll using JQuery

$(window)
      .on('load scroll', function(event) {
        event.preventDefault();
        /* Act on the event */
        if ($(window).scrollTop() < 10) {
            $('.site-navigation').addClass('top');
        } else {
            $('.site-navigation').removeClass('top');
        }
      });