|
1 | 1 | /*! |
2 | | - * Lightbox v2.9.0 |
| 2 | + * Lightbox v2.10.0 |
3 | 3 | * by Lokesh Dhakar |
4 | 4 | * |
5 | 5 | * More info: |
6 | 6 | * http://lokeshdhakar.com/projects/lightbox2/ |
7 | 7 | * |
8 | | - * Copyright 2007, 2015 Lokesh Dhakar |
| 8 | + * Copyright 2007, 2018 Lokesh Dhakar |
9 | 9 | * Released under the MIT license |
10 | 10 | * https://github.com/lokesh/lightbox2/blob/master/LICENSE |
11 | 11 | * |
|
94 | 94 | // Build html for the lightbox and the overlay. |
95 | 95 | // Attach event handlers to the new DOM elements. click click click |
96 | 96 | Lightbox.prototype.build = function() { |
| 97 | + if ($('#lightbox').length > 0) { |
| 98 | + return; |
| 99 | + } |
| 100 | + |
97 | 101 | var self = this; |
98 | 102 | $('<div id="lightboxOverlay" class="lightboxOverlay"></div><div id="lightbox" class="lightbox"><div class="lb-outerContainer"><div class="lb-container"><img class="lb-image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" /><div class="lb-nav"><a class="lb-prev" href="" ></a><a class="lb-next" href="" ></a></div><div class="lb-loader"><a class="lb-cancel"></a></div></div></div><div class="lb-dataContainer"><div class="lb-data"><div class="lb-details"><span class="lb-caption"></span><span class="lb-number"></span></div><div class="lb-closeContainer"><a class="lb-close"></a></div></div></div></div>').appendTo($('body')); |
99 | 103 |
|
|
208 | 212 |
|
209 | 213 | function addToAlbum($link) { |
210 | 214 | self.album.push({ |
| 215 | + alt: $link.attr('data-alt'), |
211 | 216 | link: $link.attr('href'), |
212 | 217 | title: $link.attr('data-title') || $link.attr('title') |
213 | 218 | }); |
|
251 | 256 |
|
252 | 257 | // Disable scrolling of the page while open |
253 | 258 | if (this.options.disableScrolling) { |
254 | | - $('body').addClass('lb-disable-scrolling'); |
| 259 | + $('html').addClass('lb-disable-scrolling'); |
255 | 260 | } |
256 | 261 |
|
257 | 262 | this.changeImage(imageNumber); |
|
282 | 287 | var windowHeight; |
283 | 288 | var windowWidth; |
284 | 289 |
|
285 | | - $image.attr('src', self.album[imageNumber].link); |
| 290 | + $image.attr({ |
| 291 | + 'alt': self.album[imageNumber].alt, |
| 292 | + 'src': self.album[imageNumber].link |
| 293 | + }); |
286 | 294 |
|
287 | 295 | $preloader = $(preloader); |
288 | 296 |
|
|
503 | 511 | visibility: 'visible' |
504 | 512 | }); |
505 | 513 | if (this.options.disableScrolling) { |
506 | | - $('body').removeClass('lb-disable-scrolling'); |
| 514 | + $('html').removeClass('lb-disable-scrolling'); |
507 | 515 | } |
508 | 516 | }; |
509 | 517 |
|
|
0 commit comments