Here is the function -
$.swipebox( [
{ href:'big/image1.jpg', title:'My Caption' },
{ href:'big/image2.jpg', title:'My Second Caption' }
] );
Instead of this I would like add a loop here or if not possible then pass an array.
Something like -
$.swipebox( [
$.each( data, function(index, val){
{ href:data[index].image_link, title:data[index].image_title }
} )
] );
or something similar to this. I will be really glad if anyone could help me with that.
You can use $.map() like
$.swipebox($.map(data, function (val, index) {
return {
href: val.image_link,
title: val.image_title
}
}));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.