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) });
Comments
Post a Comment