Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. //added by JG 3/10/2011, to extend selectors.
  2. // Example:
  3. //if ($('#whatever').is(':inView') ) {...}
  4. jQuery.extend(jQuery.expr[':'], {
  5. inView: function(a) {
  6. var st = (document.documentElement.scrollTop || document.body.scrollTop),
  7. ot = jQuery(a).offset().top,
  8. wh = (window.innerHeight && window.innerHeight < jQuery(window).height()) ? window.innerHeight : jQuery(window).height();
  9. return ot > st && (jQuery(a).height() + ot) < (st + wh);
  10. }
  11. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement