Reputation: 83
How to determine elements in the visible region of Div?
There are 2 div within main div. The wrapper div contains many child div with overflow property. On scrolling the document div i need to find out the visible children div in the wrapper.
Below is HTML structure
<div class="main">
<div class="wrapper">
<div class="comment"></div>
<div class="comment"></div>
<div class="comment"></div>
<div class="comment"></div>
<div class="comment"></div>
</div>
<div class="document"></div>
</div>
Is there any possibility for finding the number of visible div in the window?
Upvotes: 0
Views: 69
Reputation: 842
use :visible try this
$('.orginalDiv1>.waprrer div:visible').someCommand()
or
$('.orginalDiv1>.waprrer').find('div:visible').lenght()
Upvotes: 1
Reputation: 82241
Try this:
$('wrapperdivselector').find("div:visible");
for length:
$('wrapperdivselector').find("div:visible").length;
Upvotes: 1