summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Häggqvist <[email protected]>2016-01-15 01:27:28 +0100
committerVictor Häggqvist <[email protected]>2016-01-15 01:27:28 +0100
commit3dc62a2440daed6692ea3b613e6557ad5b4d42e1 (patch)
tree38c4452981f396b20b692ad1887893c5bf45cf67
parentb2ea705d93c560e82ca3822f768d5448589b6b10 (diff)
close button setting
-rw-r--r--src/Plugins/CloseButton.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Plugins/CloseButton.js b/src/Plugins/CloseButton.js
index ca12e61..1a1b453 100644
--- a/src/Plugins/CloseButton.js
+++ b/src/Plugins/CloseButton.js
@@ -6,7 +6,8 @@
export class CloseButton {
- constructor() {
+ constructor(closeOnDocumentClick=false) {
+ this.closeOnDocumentClick = closeOnDocumentClick;
this.element = document.createElement('a');
this.element.id = 'imagelightbox-close';
this.element.innerHTML = 'Close';
@@ -19,14 +20,12 @@ export class CloseButton {
}
showButton() {
+ this.lightbox.options.quitOnDocClick = this.closeOnDocumentClick;
['click', 'touchend'].forEach(name => {
this.element.addEventListener(name, this.exitLightbox.bind(this));
});
document.body.appendChild(this.element);
-
- //$('<a href="#" id="imagelightbox-close">Close</a>').appendTo('body')
- // .on('click touchend', function(){ $(this).remove(); instance.quitImageLightbox(); return false; });
}
hideButton() {
@@ -34,7 +33,7 @@ export class CloseButton {
}
exitLightbox() {
- this.lightbox.quitImageLightbox();
+ this.lightbox.quitLightbox();
}
}