get count of class which is visible element

JavaScript
$(".level1:visible").length;
Source

Also in JavaScript: