Skip to content

Instantly share code, notes, and snippets.

Created November 19, 2013 10:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save gerbenvandijk/7543128 to your computer and use it in GitHub Desktop.
Simple jQuery script to make part(s) of the site sticky when scrolled beyond a certain point.
// sticky scroll function
function ScrollNav() {
if ($(document).scrollTop() > 0) {
} else {
// initiate the code on load for when a user has scrolled before and refreshed the page
// initiate the code on scroll. note that this doest work nicely on iOs, but there is no viable workaround for this yet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment