Programmatically open fancybox passing an array
up vote
0
down vote
favorite
I have a question regarding jquery fancybox .
My code in load():
$(".fanciogallery").on("click", function(e){
e.preventDefault();
var gid = $(this).data("gid");
var fancyarray = ;
//already have an array with the infos
gallery_array[gid].forEach(function(element){
var impa = uploadfold + gid + '/immages_' + element.id_img + '.png';
//fill an array to pass to fancybox
fancyarray.push(
{href : impa, title : 'Title'}
);
});
$.fancybox.open(
fancyarray,
{
//options
loop : false
},
);
});
I am doing some testing so it's not complete or refined.
I get "The requested content cannot be loaded" but it seems to get the number of elements right.
I get this error even if I hardcode a valid imagepath into
href:
probably I am filling the array wrong, the documentation it's not clear for me.
Do you know what I am doing wrong?
Thank you
javascript jquery image fancybox
add a comment |
up vote
0
down vote
favorite
I have a question regarding jquery fancybox .
My code in load():
$(".fanciogallery").on("click", function(e){
e.preventDefault();
var gid = $(this).data("gid");
var fancyarray = ;
//already have an array with the infos
gallery_array[gid].forEach(function(element){
var impa = uploadfold + gid + '/immages_' + element.id_img + '.png';
//fill an array to pass to fancybox
fancyarray.push(
{href : impa, title : 'Title'}
);
});
$.fancybox.open(
fancyarray,
{
//options
loop : false
},
);
});
I am doing some testing so it's not complete or refined.
I get "The requested content cannot be loaded" but it seems to get the number of elements right.
I get this error even if I hardcode a valid imagepath into
href:
probably I am filling the array wrong, the documentation it's not clear for me.
Do you know what I am doing wrong?
Thank you
javascript jquery image fancybox
try to debug it and checks if yourgallery_array[gid]
is isset and not empty.
– Oleg Nurutdinov
2 days ago
yes yes it's non-empty. Thank you
– Luca Calabrese
2 days ago
It looks like you try to push json in array, maybe this can helps you? stackoverflow.com/questions/12383070/json-array-pushing
– Oleg Nurutdinov
2 days ago
possible duplicate? stackoverflow.com/questions/8828173/…
– Pete
2 days ago
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a question regarding jquery fancybox .
My code in load():
$(".fanciogallery").on("click", function(e){
e.preventDefault();
var gid = $(this).data("gid");
var fancyarray = ;
//already have an array with the infos
gallery_array[gid].forEach(function(element){
var impa = uploadfold + gid + '/immages_' + element.id_img + '.png';
//fill an array to pass to fancybox
fancyarray.push(
{href : impa, title : 'Title'}
);
});
$.fancybox.open(
fancyarray,
{
//options
loop : false
},
);
});
I am doing some testing so it's not complete or refined.
I get "The requested content cannot be loaded" but it seems to get the number of elements right.
I get this error even if I hardcode a valid imagepath into
href:
probably I am filling the array wrong, the documentation it's not clear for me.
Do you know what I am doing wrong?
Thank you
javascript jquery image fancybox
I have a question regarding jquery fancybox .
My code in load():
$(".fanciogallery").on("click", function(e){
e.preventDefault();
var gid = $(this).data("gid");
var fancyarray = ;
//already have an array with the infos
gallery_array[gid].forEach(function(element){
var impa = uploadfold + gid + '/immages_' + element.id_img + '.png';
//fill an array to pass to fancybox
fancyarray.push(
{href : impa, title : 'Title'}
);
});
$.fancybox.open(
fancyarray,
{
//options
loop : false
},
);
});
I am doing some testing so it's not complete or refined.
I get "The requested content cannot be loaded" but it seems to get the number of elements right.
I get this error even if I hardcode a valid imagepath into
href:
probably I am filling the array wrong, the documentation it's not clear for me.
Do you know what I am doing wrong?
Thank you
javascript jquery image fancybox
javascript jquery image fancybox
edited 2 days ago
barbsan
2,131521
2,131521
asked 2 days ago
Luca Calabrese
374
374
try to debug it and checks if yourgallery_array[gid]
is isset and not empty.
– Oleg Nurutdinov
2 days ago
yes yes it's non-empty. Thank you
– Luca Calabrese
2 days ago
It looks like you try to push json in array, maybe this can helps you? stackoverflow.com/questions/12383070/json-array-pushing
– Oleg Nurutdinov
2 days ago
possible duplicate? stackoverflow.com/questions/8828173/…
– Pete
2 days ago
add a comment |
try to debug it and checks if yourgallery_array[gid]
is isset and not empty.
– Oleg Nurutdinov
2 days ago
yes yes it's non-empty. Thank you
– Luca Calabrese
2 days ago
It looks like you try to push json in array, maybe this can helps you? stackoverflow.com/questions/12383070/json-array-pushing
– Oleg Nurutdinov
2 days ago
possible duplicate? stackoverflow.com/questions/8828173/…
– Pete
2 days ago
try to debug it and checks if your
gallery_array[gid]
is isset and not empty.– Oleg Nurutdinov
2 days ago
try to debug it and checks if your
gallery_array[gid]
is isset and not empty.– Oleg Nurutdinov
2 days ago
yes yes it's non-empty. Thank you
– Luca Calabrese
2 days ago
yes yes it's non-empty. Thank you
– Luca Calabrese
2 days ago
It looks like you try to push json in array, maybe this can helps you? stackoverflow.com/questions/12383070/json-array-pushing
– Oleg Nurutdinov
2 days ago
It looks like you try to push json in array, maybe this can helps you? stackoverflow.com/questions/12383070/json-array-pushing
– Oleg Nurutdinov
2 days ago
possible duplicate? stackoverflow.com/questions/8828173/…
– Pete
2 days ago
possible duplicate? stackoverflow.com/questions/8828173/…
– Pete
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
Check samples from documentation - http://fancyapps.com/fancybox/3/docs/#api -
$.fancybox.open([
{
src : '1_b.jpg',
opts : {
caption : 'First caption',
thumb : '1_s.jpg'
}
},
{
src : '2_b.jpg',
opts : {
caption : 'Second caption',
thumb : '2_s.jpg'
}
}
], {
loop : false
});
Basically, replace href
with src
I feel very stupid now.
– Luca Calabrese
2 days ago
No worries, you were using syntax from v2, but v3 has completely different API.
– Janis
yesterday
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
Check samples from documentation - http://fancyapps.com/fancybox/3/docs/#api -
$.fancybox.open([
{
src : '1_b.jpg',
opts : {
caption : 'First caption',
thumb : '1_s.jpg'
}
},
{
src : '2_b.jpg',
opts : {
caption : 'Second caption',
thumb : '2_s.jpg'
}
}
], {
loop : false
});
Basically, replace href
with src
I feel very stupid now.
– Luca Calabrese
2 days ago
No worries, you were using syntax from v2, but v3 has completely different API.
– Janis
yesterday
add a comment |
up vote
0
down vote
accepted
Check samples from documentation - http://fancyapps.com/fancybox/3/docs/#api -
$.fancybox.open([
{
src : '1_b.jpg',
opts : {
caption : 'First caption',
thumb : '1_s.jpg'
}
},
{
src : '2_b.jpg',
opts : {
caption : 'Second caption',
thumb : '2_s.jpg'
}
}
], {
loop : false
});
Basically, replace href
with src
I feel very stupid now.
– Luca Calabrese
2 days ago
No worries, you were using syntax from v2, but v3 has completely different API.
– Janis
yesterday
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
Check samples from documentation - http://fancyapps.com/fancybox/3/docs/#api -
$.fancybox.open([
{
src : '1_b.jpg',
opts : {
caption : 'First caption',
thumb : '1_s.jpg'
}
},
{
src : '2_b.jpg',
opts : {
caption : 'Second caption',
thumb : '2_s.jpg'
}
}
], {
loop : false
});
Basically, replace href
with src
Check samples from documentation - http://fancyapps.com/fancybox/3/docs/#api -
$.fancybox.open([
{
src : '1_b.jpg',
opts : {
caption : 'First caption',
thumb : '1_s.jpg'
}
},
{
src : '2_b.jpg',
opts : {
caption : 'Second caption',
thumb : '2_s.jpg'
}
}
], {
loop : false
});
Basically, replace href
with src
answered 2 days ago
Janis
6,09311322
6,09311322
I feel very stupid now.
– Luca Calabrese
2 days ago
No worries, you were using syntax from v2, but v3 has completely different API.
– Janis
yesterday
add a comment |
I feel very stupid now.
– Luca Calabrese
2 days ago
No worries, you were using syntax from v2, but v3 has completely different API.
– Janis
yesterday
I feel very stupid now.
– Luca Calabrese
2 days ago
I feel very stupid now.
– Luca Calabrese
2 days ago
No worries, you were using syntax from v2, but v3 has completely different API.
– Janis
yesterday
No worries, you were using syntax from v2, but v3 has completely different API.
– Janis
yesterday
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53373090%2fprogrammatically-open-fancybox-passing-an-array%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
try to debug it and checks if your
gallery_array[gid]
is isset and not empty.– Oleg Nurutdinov
2 days ago
yes yes it's non-empty. Thank you
– Luca Calabrese
2 days ago
It looks like you try to push json in array, maybe this can helps you? stackoverflow.com/questions/12383070/json-array-pushing
– Oleg Nurutdinov
2 days ago
possible duplicate? stackoverflow.com/questions/8828173/…
– Pete
2 days ago