summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Häggqvist <[email protected]>2016-01-14 23:03:49 +0100
committerVictor Häggqvist <[email protected]>2016-01-14 23:03:49 +0100
commit04d1f87116804c5f9eddba59ef79c75b61b80c5b (patch)
tree0757e05ac05d8d91db8c1e840bf1c7f2f6c649cc
parent4b570dce9af4307eac2fe8d26323066215464ccd (diff)
only slide image out when touching
-rw-r--r--src/LightBox.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/LightBox.js b/src/LightBox.js
index e2094c1..8bb2c48 100644
--- a/src/LightBox.js
+++ b/src/LightBox.js
@@ -86,7 +86,7 @@ export class LightBox {
this.target = this.targets[gotoIndex];
}
- this.loadImage(e.keyCode === 37 ? LightDirection.LEFT : LightDirection.RIGHT);
+ this.loadImage();
}
}
@@ -169,7 +169,12 @@ export class LightBox {
log.debug('unload');
CSSUtil.setTransitionProperty(this.image, 'opacity '+this.options.animationSpeed/1000+'s linear');
- let transitionArgs = (100 * direction) - this.swipeDiff + 'px';
+
+ let transitionArgs = '0px';
+ if (direction !== false) {
+ transitionArgs = (100 * direction) - this.swipeDiff + 'px';
+ }
+
this.image.style.transform = 'translateX('+transitionArgs+')';
setTimeout(() => {
@@ -287,7 +292,7 @@ export class LightBox {
this.target = this.targets[gotoIndex];
}
- this.loadImage(this.imageWidth / 2 > posX ? LightDirection.LEFT : LightDirection.RIGHT);
+ this.loadImage();
}
imageTouchStart(e) {