user3219396
user3219396

Reputation: 83

How to find elements in the active area that is visible on the page using jquery

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

Answers (2)

saman khademi
saman khademi

Reputation: 842

use :visible try this

$('.orginalDiv1>.waprrer div:visible').someCommand()

or

$('.orginalDiv1>.waprrer').find('div:visible').lenght()

Upvotes: 1

Milind Anantwar
Milind Anantwar

Reputation: 82241

Try this:

 $('wrapperdivselector').find("div:visible");

for length:

 $('wrapperdivselector').find("div:visible").length;

Demo

Upvotes: 1

Related Questions