使用带有fancybox的图像URL数组

时间:2014-11-18 19:48:16

标签: javascript jquery arrays

基本上我有一系列图像网址,我试图传递给花哨的框

$('#' + value.id).click(function(){
                                $.fancybox({


                                });
                        })

我点击了一个div,我需要它来打开带有图库的fancybox。

我只需要知道如何迭代数组以获取元素并将其格式化以传递给奇特的盒子,或者如果有办法传递整个数组。

1 个答案:

答案 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