I have an array called gallery_list:
var gallery_list = ["profile.cfm", "explore.cfm", "list.cfm", "lesson.cfm", "class.cfm", "deploy_to_class.cfm"];
When I write the following, it works:
$.fancybox([
{ 'href' : gallery_list[0],
'type' : 'iframe' },
{ 'href' : gallery_list[1],
'type' : 'iframe' },
{ 'href' : gallery_list[2],
'type' : 'iframe' },
{ 'href' : gallery_list[3],
'type' : 'iframe' },
{ 'href' : gallery_list[4],
'type' : 'iframe' },
{ 'href' : gallery_list[5],
'type' : 'iframe' },
]);
But if I try to do something like below, it does not work:
var data = new Array();
for (i = 0; i < gallery_list.length, i++) {
var obj = {
'href' : gallery_list[i],
'type' : 'iframe'
}
data.push(obj);
}
$.fancybox([
data
]);
Can anyone provide any insight? Clearly I am getting something wrong with my data structures but I'm not sure what it is...