我在使用 JQuery Galleria 时遇到问题,那里的支持人员说这是一个错误,要修复它,我必须将我的图像放入我的 Javascript 中的 JSON var 数据对象中。
对我来说不幸的是,我没有这样做的经验,他们的信息也不是很清楚。在他们的网站支持上,他们以以下代码为例:
var data = [
{
image: 'img1.jpg' thumb: 'thumb1.jpg' title: 'my first image', description: 'Lorem ipsum caption' link: 'http://domain.com'
}, {
image: 'img2.jpg' thumb: 'thumb2.jpg' title: 'my second image', description: 'Another caption' link: '/path/to/destination.html'
}
];
$('#container').galleria({
data_source: data
});
目前我只是创建大图形,然后在 Javascript 中调用它们,如下所示:
$(document).ready(function() {
// Load theme
Galleria.loadTheme('themes/classic/galleria.classic.js');
// run galleria and add some options
$('#galleria').galleria({
debug: true,
image_crop: true,
height: 397,
max_scale_ratio: 1, //Ensures the picture crop doesn't zoom the picture
autoplay: 8000, //Sets an autoplay interval of 8 seconds (8000)
transition: 'fade',
data_config: function(img) {
return {
description: $(img).next('p').html()
};
}
});
有人可以帮助我了解下一步我必须做什么才能进行设置并测试它是否有效?鉴于我缺乏 JSON 编码经验,我可能需要一个示例来指导我该怎么做。谢谢。