javascript - Get a div offset for one page site -


here have used bootstrap fixed navigation.

i have section

<section id="count" class="count-section">   // here code  </section> 

i trying apply animation, if user scroll , see on portion. here trying make measure offset. have tried below code

$(window).scroll(function() {     var pos = $('#count').offset().top;     console.log(pos); }  

after reload page got value 1539.5333404541016 after scroll page value 1539.5333251953125.

how can measure position top fixed navigation ?

something might work:

$(window).scroll(function() {     var pos = $('#count').offset().top - $(document).scrolltop();     console.log(pos); }); 

take @ $(window).height() , $(document).scrolltop().


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -