I create a javaScript gallery where the document can handle a variable number of <div class="gallery">
elements.
I thought to define a multi-dimensional array which stores information for every existing galery.
JavaScript + jQuery 1.9.1
var gallery = new Array;
gallery = ['images','imageActive','width'];
for (var i=0;i<$('.gallery').length;i++) {
gallery[i]['images'] = $('.gallery:eq['+i+'] img').index();
gallery[i]['imageActive'] = 0;
gallery[i]['width'] = $('.gallery:eq['+i+'] li').css('width');
}
Console output
Is my approach totally wrong? Are arrays not intended for this case?