防止 Galleriffic jquery 插件重新加载同一张图像两次
是否可以阻止 Gallerific 插件重新加载已显示的相同图像?
例如,如果用户单击同一缩略图两次,图库图像将重新加载。 Galleriffic 是否可以确定用户两次请求同一图像,因此在请求新图像之前不应重新加载?
Is it possible to prevent the Gallerific plugin from reloading the same image that’s already showing?
For instance, if a user clicks on the same thumbnail twice, the gallery image reloads. Can Galleriffic determine that the user is requesting the same image twice and thus should not reload until a new image is requested?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我刚刚添加了一个静态变量来跟踪每次图像被触发的情况。如果加载第一个图像,则会跳过我的“重新加载预防脚本”。
I just added a static variable to keep track each time an image is fired. If the first image is loaded, my "reload prevention script" is skipped.
好吧,我大约 70% 会自己回答这个问题,但唯一的问题是我必须忽略第一张图像(索引为 0),否则它将无法启动图库。
插入这段逻辑:
到这个函数中:
Well, I'm about 70% there to answering it myself, but the only problem is that I have to ignore the first image (at index 0) or it won't start the gallery.
Inserted this bit of logic:
Into this function: