Skip to content

Instantly share code, notes, and snippets.

@juanbrujo
Last active March 23, 2017 21:06
Show Gist options
  • Save juanbrujo/6497393 to your computer and use it in GitHub Desktop.
Save juanbrujo/6497393 to your computer and use it in GitHub Desktop.
Detect with jQuery if an element enters the viewport ( visible() )
var win = $(window);
var allMods = $(".box_blog_post");
win.scroll(function(event) {
allMods.each(function(i, el) {
if (el.visible(true)) {
el.addClass("visible");
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment