Skip to content

Instantly share code, notes, and snippets.

@fabiorochafg
Created September 11, 2019 02:05
Show Gist options
  • Save fabiorochafg/5d56df0355bd846d6ec0242f0f9e2f3f to your computer and use it in GitHub Desktop.
Save fabiorochafg/5d56df0355bd846d6ec0242f0f9e2f3f to your computer and use it in GitHub Desktop.
Adding CSS class do BODY tag when page is scrolled.
$(window).scroll(function() {
if ($(this).scrollTop() == 0) {
$("body").removeClass("scrolled");
} else {
$("body").addClass("scrolled");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment