Skip to content

Instantly share code, notes, and snippets.

@galengidman
Created December 20, 2013 22:15
Show Gist options
  • Save galengidman/8062511 to your computer and use it in GitHub Desktop.
Save galengidman/8062511 to your computer and use it in GitHub Desktop.
function classIfOffset(element, class, offset) {
var scroll = $(window).scrollTop();
if (scroll > offset) {
element.addClass(class);
} else {
element.removeClass(class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment