Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/js/lightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
Lightbox.prototype.init = function() {
this.enable();
this.build();
this.wordpress();
};

// Loop through anchors and areamaps looking for either data-lightbox attributes or rel attributes
Expand Down Expand Up @@ -137,6 +138,20 @@
});
};

// Lightbox to WordPress gallery
Lightbox.prototype.wordpress = function() {
if ($('meta[name=generator][content*=WordPress]').length === 1) {
$('.gallery').each(function () {
var id = $(this).attr('id');
$(this).find('a').each(function () {
if ($(this).attr('href').indexOf('attachment_id') === -1) {
$(this).attr('data-lightbox', id);
}
});
});
}
};

// Show overlay and lightbox. If the image is part of a set, add siblings to album array.
Lightbox.prototype.start = function($link) {
var self = this;
Expand Down