summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Häggqvist <[email protected]>2016-01-14 22:57:23 +0100
committerVictor Häggqvist <[email protected]>2016-01-14 22:57:23 +0100
commit4b570dce9af4307eac2fe8d26323066215464ccd (patch)
tree6e25974db5281307d41bc616e1e8a38ec5e8d074
parent382401d527314b270e1c67b4f88cd3bfbca81d46 (diff)
fix undefined next preload
-rw-r--r--src/LightBox.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/LightBox.js b/src/LightBox.js
index 5479819..e2094c1 100644
--- a/src/LightBox.js
+++ b/src/LightBox.js
@@ -216,10 +216,10 @@ export class LightBox {
}, this.options.animationSpeed);
if (this.options.preloadNext) {
- let index = Array.prototype.indexOf.call(this.targets, this.target)
+ let index = Array.prototype.indexOf.call(this.targets, this.target);
let next = this.targets[index + 1];
- if (next !== null) {
+ if (next !== null && next !== undefined) {
log.debug('preloading next');
let nextImg = new Image();
nextImg.src = next.href;