jquery - returning the same Offset top value on a group of different divs -


i have this:

  <div class="all">     <div class="first"></div>     <div class="second"></div>     <div class="third"></div>     <div class="four"></div>   </div> 

and trying offset of divs inside "all".

i doing this:

$( ".all div" ).each(function( ) {    var etop=$(this).offset().top;     console.log(etop);     $(window).scroll(function() {       console.log(etop  - $(window).scrolltop());   }); }); 

it returns same value 4 divs. think returning "scrolltop", not offset.

in css, has position:relative , child divs have position:relative well.

anyone can me?

thanks lot


Comments

Popular posts from this blog

How to access named pipes using JavaScript in Firefox add-on? -

multithreading - OPAL (Open Phone Abstraction Library) Transport not terminated when reattaching thread? -

node.js - req param returns an empty array -