jquery find visible code example

Example 1: jquery visible

$(":visible");
//or
$().is(":visible");

Example 2: jquery visible

$(element).is(":visible");
$(element).is(":hidden");

Example 3: how to detect a section is visible in jquery

$.fn.isInViewport = function() {var elementTop = $(this).offset().top;var elementBottom = elementTop + $(this).outerHeight();var viewportTop = $(window).scrollTop();var viewportBottom = viewportTop + $(window).height();return elementBottom > viewportTop && elementTop < viewportBottom;};