基本上我有一系列图像网址,我试图传递给花哨的框
$('#' + value.id).click(function(){
$.fancybox({
});
})
我点击了一个div,我需要它来打开带有图库的fancybox。
我只需要知道如何迭代数组以获取元素并将其格式化以传递给奇特的盒子,或者如果有办法传递整个数组。
答案 0 :(得分:0)
您可以使用for loop
或使用:
// Create a string which will store my formated array data
var s = new String();
yourarray.forEach(function(element, index, array){
// Format array data here. For example I will concatenate all the elements in the array with space between them
s.concat(element + " ");
};
// Pass s to fancybox