Created
November 19, 2013 10:07
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
ScrollNav(); | |
// initiate the code on scroll. note that this doest work nicely on iOs, but there is no viable workaround for this yet. | |
$(window).scroll(function(){ | |
ScrollNav(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment