Skip to content

Instantly share code, notes, and snippets.

@alexmoleiro
Created October 3, 2014 16:17
Show Gist options
  • Select an option

  • Save alexmoleiro/94531a536d74a48d7c11 to your computer and use it in GitHub Desktop.

Select an option

Save alexmoleiro/94531a536d74a48d7c11 to your computer and use it in GitHub Desktop.
¿Está el elemento del DOM dentro de la vista?
Util.isScrolledIntoView=function(elem)
{
var docViewTop = $(window).scrollTop();
var docViewBottom = docViewTop + $(window).height();
var elemTop = $(elem).offset().top;
var elemBottom = elemTop + $(elem).height();
return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment