Check if an element is in view using only JQuery.
A sort of poor man’s Waypoints.
$(window).on('load scroll', function() { $('.element').each(function() { if ( $(this).offset().top <= ($(window).scrollTop() + $(window).height()/2)) { // in view (in the upper half of the screen) } else { // not in view } }); });
Leave a Reply