Micoxion Micoxion - 1 year ago 77
Javascript Question

How to get offset value of a large amount of span's with a common class

I currently have a large amount of span's all with a common class (as you probably guessed from the title). When I try:


I am trying to check for a collision between one element and all of the spans without creating over 10 unique id's and
calls. But I only recieve the
value for the first element with the class in the HTML.

So is there a way to check the position on all these elements without 10 or so extra lines of code? Thanks in advance!

var spanArr = [];
$("span.span-class").each(function () {