jquery - Find .offset of each element with X class -


i'd know how can .offset of multiple elements variables, idea this:

var position = $(this).offset().top; $(".number").text(position); 

and way, every element .number class display own particular offset, problem isn't working, it's undefined, , can't seem figure out how it.

any appreciated.

thanks in advance!

you can use function parameter of text() method:

$(".number").text(function(){    return $(this).offset().top; // or this.offsettop (relative parent node) }); 

-jsfiddle-


Comments

Popular posts from this blog

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -