jquery when element is viewable in dom code example
Example 1: jquery how to know if element is visible
// Checks CSS content for display:[none|block], ignores visibility:[true|false]
$(element).is(":visible");
// The same works with hidden
$(element).is(":hidden");
Example 2: get count of class which is visible element
$(".level1:visible").length;