diff --git a/index.html b/index.html index b065f5f..34d3c8a 100644 --- a/index.html +++ b/index.html @@ -332,6 +332,7 @@

Api and options

bindToItems: true, // set click event handler to trigger lightbox on provided $items closeOnOverlayClick: true, closeOnEscapeKey: true, + closeOnImageClick: false, nextOnImageClick: true, showCaptions: true, diff --git a/src/simpleLightbox.js b/src/simpleLightbox.js index cf0b88f..0379b06 100644 --- a/src/simpleLightbox.js +++ b/src/simpleLightbox.js @@ -95,6 +95,7 @@ bindToItems: true, // set click event handler to trigger lightbox on provided $items closeOnOverlayClick: true, closeOnEscapeKey: true, + closeOnImageClick: false, nextOnImageClick: true, showCaptions: true, @@ -433,9 +434,12 @@ matches($target, '.next') ? self.next() : self.prev(); - } else if (self.options.nextOnImageClick && self.items.length > 1 && matches($target, '.slbImage')) { - - self.next(); + } else if (self.items.length > 1 && matches($target, '.slbImage')) { + if (self.options.nextOnImageClick) { + self.next(); + } else if (self.options.closeOnImageClick) { + self.close(); + } }