Skip to content

Commit cdf71e1

Browse files
committed
Fix: Links in captions not clickable
1 parent 0c405ad commit cdf71e1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

js/lightbox.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,16 @@
319319
// Display caption, image number, and closing button.
320320
Lightbox.prototype.updateDetails = function() {
321321
var self = this;
322-
322+
323+
// Enable anchor clicks in the injected caption html.
324+
// Thanks Nate Wright for the fix. @https://github.com/NateWr
323325
if (typeof this.album[this.currentImageIndex].title !== 'undefined' && this.album[this.currentImageIndex].title !== "") {
324-
this.$lightbox.find('.lb-caption').html(this.album[this.currentImageIndex].title).fadeIn('fast');
326+
this.$lightbox.find('.lb-caption')
327+
.html(this.album[this.currentImageIndex].title)
328+
.fadeIn('fast')
329+
.find('a').on('click', function(event){
330+
location.href = $(this).attr('href');
331+
});
325332
}
326333

327334
if (this.album.length > 1 && this.options.showImageNumberLabel) {

0 commit comments

Comments
 (0)