Skip to content

Instantly share code, notes, and snippets.

@mahemoff
Created November 17, 2014 16:08
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 mahemoff/f63276756660c7bee8a7 to your computer and use it in GitHub Desktop.
Save mahemoff/f63276756660c7bee8a7 to your computer and use it in GitHub Desktop.
Live scrolling calculation - can user see bottom of element (or already scrolled past it)
elementBottom = $(element).offset().top + $(element).height()
lowestVisiblePointInBrowser = $(window).scrollTop() + $(window).height()
isElementBottomVisible = lowestVisiblePointInBrowser > elementBottom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment