scroll - Get position of clicked element with jquery? -


i want scroll item view when it's clicked, cannot manage it's top position on click:

this i'm trying right now:

    $( "section" ).click(function(e) {         console.log("thing top: "+$(this).position().top);         //$('html,body').animate({ scrolltop: 0 }, 'slow');         //return false;      }); 

however same top position, matter element clicked. how can right?

try $(this).offset().top gets position relative document rather parent

offset


Comments

Popular posts from this blog

c++ - Linked List error when inserting for the last time -

java - activate/deactivate sonar maven plugin by profile? -

java - What is the difference between String. and String.this. ? -