mrkrand
4/5/2016 - 3:04 PM

jQuery script thats toggles not-top class to body tag if user scrolls away

jQuery script thats toggles not-top class to body tag if user scrolls away

function pageNotTop() {
	var notTop = false;
	var body = jQuery('body');
	jQuery(document).scroll(function() {
      if (jQuery(document).scrollTop() > 0) {
          if (!notTop) {
              notTop = true;
              body.addClass('not-top');
          }
      } else {
          notTop = false;
          body.removeClass('not-top');
      }
  });
}
pageNotTop();