【发布时间】:2010-06-23 13:07:23
【问题描述】:
我在使用 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 编码经验,我可能需要一个示例来引导我完成操作。谢谢。
【问题讨论】: