有没有可能阻止Gallerific插件重新加载已经显示的相同图像?
例如,如果用户点击同一缩略图两次,图库图像就会重新加载。Galleriffic是否可以确定用户正在请求同一图像两次,因此在请求新图像之前不应重新加载?
发布于 2010-06-24 08:48:36
我只是添加了一个静态变量来跟踪每次触发图像的时间。如果加载了第一个镜像,我的“重载防止脚本”将被跳过。
gotoImage: function(imageData) {
var index = imageData.index;
if(typeof foo == 'undefined') {
foo = 0;
};
foo++;
if (foo == 1 | index != this.currentImage.index){
if (this.onSlideChange)
this.onSlideChange(this.currentImage.index, index);
this.currentImage = imageData;
this.preloadRelocate(index);
this.refresh();
};
return this;
},发布于 2010-06-24 07:27:52
好吧,我自己回答了大约70%,但唯一的问题是我必须忽略第一个图像(在索引0处),否则它不会启动图库。
插入了这段逻辑:
if (index == 0 | index != this.currentImage.index){}; 进入此函数:
gotoImage: function(imageData) {
var index = imageData.index;
if (index == 0 | index != this.currentImage.index){
if (this.onSlideChange)
this.onSlideChange(this.currentImage.index, index);
this.currentImage = imageData;
this.preloadRelocate(index);
this.refresh();
};
return this;
},https://stackoverflow.com/questions/3105075
复制相似问题