For this segment of code:
for (var i = 0; i < numbers.length; i++) {
var imageCrystal = $('<img>');
imageCrystal.attr('data-num', numbers[i]);
....
}
is, imageCrystal.attr('data-num', numbers[i]); making a data attribute for the image tag that was just created and giving it a class name called "data-num" and then assigning whatever the value is at number[i]?
data-are an HTML5 thing for storing data in the element. So ifnumbers[i]was 3, this would make animageCrystalelement that looks like<img data-num="3" />. Data attributes can also be accessed using the jQuerydatafunction, soimageCrystal.data("num")should return 3.imageCrystal.data('num', numbers[i]);also if you use thedata()method.