我正在构建一个以画廊为主要特征的网站,我需要画廊有“类别”。我将通过 AJAX 加载图像,但目前证明只是让 Galleria 画廊加载不同的图像具有挑战性。我的代码如下:
function swap_gallery() {
var new_slideshow = [
{ image: '../images/slideshow/architecture_3.jpg' },
{ image: '../images/slideshow/report_1.jpg' }
];
Galleria.get(0).load({
data_source: new_slideshow
});
}
当我运行这个函数时,我在 Firebug 中得到这个错误:
Error: Load failed: no data found.
我这辈子都解决不了这个问题。
最佳答案
只需像处理数组一样推送新值。
Galleria.get(0).push({image: '../images/slideshow/architecture_3.jpg'});
Galleria API #Manipulation http://galleria.aino.se/docs/1.2/api/methods/
关于javascript - 帮助将图像动态加载到 Galleria,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6648163/