Parcourir la source

Allow other elements to start the gallery

Allow other elements to start Lightbox on behalf of other elements.
It allows them to act as a sort of <label> for another element that
actually contains the data-lightbox attribute.

The way it works is: you specify the data-lightbox-label-for
attribute for an element. The value of that attribute is the HTML
id of a link that contains a data-lightbox attribute of a rel
attribute containing "lightbox".
master
Parent
révision
d2379e8187
1 fichiers modifiés avec 5 ajouts et 0 suppressions
  1. +5
    -0
      js/lightbox.js

+ 5
- 0
js/lightbox.js Voir le fichier

@@ -52,6 +52,11 @@
self.start($(event.currentTarget));
return false;
});
$('body').on('click', '*[data-lightbox-label-for]', function(event) {
var lightboxElement = $(event.currentTarget).data('lightboxLabelFor');
self.start($("#" + lightboxElement));
return false;
});
};

// Build html for the lightbox and the overlay.


Chargement…
Annuler
Enregistrer