diff options
| author | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2021-07-22 16:07:19 +0200 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2021-07-22 16:19:12 +0200 |
| commit | a3da1483a9e689846179159355badfec8073dbec (patch) | |
| tree | 770dcca6bdf5f6f2a11b0e7fcbbeda6919a3fc52 /resources/assets/javascripts/bootstrap/lightbox.js | |
current code from svn, revision 62608
Diffstat (limited to 'resources/assets/javascripts/bootstrap/lightbox.js')
| -rw-r--r-- | resources/assets/javascripts/bootstrap/lightbox.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/resources/assets/javascripts/bootstrap/lightbox.js b/resources/assets/javascripts/bootstrap/lightbox.js new file mode 100644 index 0000000..ff5b985 --- /dev/null +++ b/resources/assets/javascripts/bootstrap/lightbox.js @@ -0,0 +1,31 @@ +$(document) + .on('click', 'a[href][data-lightbox]', function() { + var gallery = $(this).data().lightbox, + elements = $(this), + images = [], + index = 0; + + if (gallery) { + elements = $('a[href][data-lightbox="' + gallery + '"]'); + index = elements.index(this); + } + + elements.each(function() { + images.push({ + src: $(this).attr('href'), + title: $(this).data().title || $(this).attr('title') + }); + }); + + STUDIP.Lightbox.setImages(images); + STUDIP.Lightbox.show(index); + + return false; + }) + .on('resize', function() { + STUDIP.Lightbox.init(); + }); + +STUDIP.domReady(function () { + STUDIP.Lightbox.init(); +}); |
