Skip to content

Instantly share code, notes, and snippets.

@curtisj44
Last active December 12, 2015 07:09
Show Gist options
  • Save curtisj44/4734483 to your computer and use it in GitHub Desktop.
Save curtisj44/4734483 to your computer and use it in GitHub Desktop.
Show hidden items as they appear in viewport
var windowBottom = $(window).scrollTop() + $(window).height();
$(window).scroll(function () {
$('.hideme').each(function (i) {
var $this = $(this),
objectBottom = $(this).position().top + $(this).outerHeight();
if (windowBottom > objectBottom) {
$(this).animate({'opacity': '1'}, 500);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment