Skip to content

Instantly share code, notes, and snippets.

@lennym
Forked from avhm/gist:703244
Created November 17, 2010 11:09
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 lennym/703272 to your computer and use it in GitHub Desktop.
Save lennym/703272 to your computer and use it in GitHub Desktop.
$.expr[':'].onscreen = function(obj){
var $win = $(window), pos = $(obj).position();
return $.contains(document.documentElement, obj) && pos.top < $win.height() && pos.left < $win.width();
};
$.expr[':'].offscreen = function(obj){
return !$(obj).is(':onscreen');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment