Skip to content

Instantly share code, notes, and snippets.

@nola
Created October 8, 2015 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nola/5ba629235bc7b331912b to your computer and use it in GitHub Desktop.
Save nola/5ba629235bc7b331912b to your computer and use it in GitHub Desktop.
get page scroll position based on timer. Not scroll event.
var didScroll = false;
$(window).scroll(function() {
didScroll = true;
});
setInterval(function() {
var winheight = $(window).scrollTop();
var winheightdiff = $(window).height() - 65;
if (!!didScroll) {
didScroll = false;
// Check your page position and then
if (winheight > winheightdiff - 200) {
// do something
}
}
}, 250);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment