我有一个使用IO
的画廊,一切都运行得很顺利,但当我尝试删除画廊上的选定图像时,我遇到了一个问题。
下面是我使用的代码
var gallery = $('#galleriaID').data('galleria');
var index = gallery.getIndex();
gallery.splice(index,1);
gallery.next();
一切都运行得很顺利,但是当我尝试删除图库中的penultimate
图像时,它并没有被移除,而且图库在我正在观察的控制台中是blocked
的
TypeError: data is undefined
version "+version+" to use one or more components.";if(Galleria.version<version...
galler...BC32189 (line 3)
TypeError: self.getData(...) is undefined
我知道我只是试图删除画廊中的penultimate
图像,我做错了什么,有一些解决方法??
非常感谢。
发布于 2013-10-24 22:33:27
我自己也一直在解决同样的问题,并且有一个合理的变通方法,使用与galleria-1.3.js
一起工作的show()
和setIndex()
var galleria = $('#galleria').data('galleria');
var galleriaLength = galleria.getDataLength();
var currentIndex = galleria.getIndex();
var nextIndex = (currentIndex == galleriaLength - 1) ? 0 : currentIndex + 1;
// Remove the image from the Galleria film slideshow
galleria.splice(currentIndex, 1);
if (galleriaLength > 1) {
// Need to use show() and setIndex() because next() doesn't work on the
// penultinate image.
galleria.show(nextIndex);
galleria.setIndex((nextIndex == 0) ? 0 : nextIndex - 1);
// Set a delay of 50ms because there seems to be a race condition
// of trying to preload images that haven't been spliced out of
// the gallery yet (working theory).
galleria.lazyLoadChunks(10, 50);
// Hack to set the counter because setCounter() isn't working here
$('.galleria-counter .galleria-current').html(indexToSet + 1);
} else {
// Destroy Galleria when there are no more images
galleria.destroy();
}
https://stackoverflow.com/questions/18897535
复制相似问题