Created
March 30, 2012 14:21
-
-
Save Demwunz/2251871 to your computer and use it in GitHub Desktop.
jQuery : inview psuedo-selector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//this is straight from http://forrst.com/posts/jQuery_inview_selector-V2Q | |
$.extend($.expr[':'], { | |
inview: function(el) { | |
var e = $(el), | |
w = $(window), | |
wt = w.scrollTop(), | |
wb = wt + w.height(), | |
et = e.offset().top, | |
eb = et + e.height(); | |
return eb >= wt && et <= wb; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment