画廊:显示最后一张图片



这是当前的Galleria API: http://galleria.aino.se/docs/1.2/api/methods/

给定这个API,我想显示我刚刚上传并推送到画廊的图片:

 Galleria.get(0).push({
     image: '<%= @photo.photo.url %>',
     thumb: '<%= @photo.photo.thumb.url %>',
     title: '<%= @photo.title %>'
 });

我正在考虑简单地使用.show( index )方法,但我不知道如何获得索引,而不必计算一些容器的孩子…

你看到一个方法来获得最后一张图片的索引使用api吗?

谢谢。


编辑

查看galleria对象,我想我可以访问"私有"变量,如_data并获得长度…但如果你找到更好的方法,那就去吧;)

Galleria.get(0).getDataLength() - 1;

内部:

getDataLength = function () {
    return this._data.length;
}

最新更新